feat: implement user & family group management tRPC router
- Add user router with me/update/delete procedures (protected) - Add family router with listMembers/invite/remove/updateRole procedures - Create user service layer (getUserById, updateUser, deleteUser) - Create family service layer (getFamilyGroup, inviteMember, removeMember, updateMemberRole, transferOwnership) - Add Valibot input schemas for all procedures - Add invitations table with status tracking and expiration - Add deletedAt column to users table (soft-delete) - Wire user router into app root router - Write unit tests for service functions and tRPC procedures - Update schema tests for new table/columns
This commit is contained in:
21
web/src/server/api/schemas/user.ts
Normal file
21
web/src/server/api/schemas/user.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { object, string, email, minLength, optional, picklist } from "valibot";
|
||||
|
||||
export const UpdateUserSchema = object({
|
||||
name: optional(string([minLength(1)])),
|
||||
email: optional(string([email()])),
|
||||
image: optional(string()),
|
||||
});
|
||||
|
||||
export const InviteMemberSchema = object({
|
||||
email: string([email()]),
|
||||
role: optional(picklist(["admin", "member"]), "member"),
|
||||
});
|
||||
|
||||
export const RemoveMemberSchema = object({
|
||||
userId: string(),
|
||||
});
|
||||
|
||||
export const UpdateRoleSchema = object({
|
||||
userId: string(),
|
||||
role: picklist(["owner", "admin", "member"]),
|
||||
});
|
||||
Reference in New Issue
Block a user