Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | import type { UserRole as PrismaUserRole } from '@prisma/client';
import type { Locale } from './common';
// Re-export Prisma UserRole as the canonical type
export type { UserRole } from '@prisma/client';
/**
* Base User type - shared fields across all contexts
*/
export type BaseUser = {
id: string;
userName: string;
firstName: string;
lastName: string;
role: PrismaUserRole;
locale: Locale;
};
/**
* Full User type with all database fields
* Used in GraphQL operations and backend
*/
export type User = BaseUser & {
email: string;
createdAt: Date;
updatedAt: Date;
};
/**
* Session User type for NextAuth
* Extends BaseUser with session-specific fields
*/
export type SessionUser = BaseUser & {
email?: string; // Optional in session
rememberMe?: boolean;
};
// --- API Types ---
import type { OperationResponse } from './graphql/responses';
// Mutation inputs
export type UserRegisterInput = {
firstName: string;
lastName: string;
userName: string;
email: string;
password: string;
confirmPassword: string;
locale?: Locale;
};
export type UserLoginInput = {
email: string;
password: string;
};
export type UserUpdateInput = {
firstName?: string;
lastName?: string;
locale?: Locale;
};
export type PasswordEditInput = {
currentPassword: string;
newPassword: string;
confirmNewPassword: string;
};
// Mutation arguments
export type CreateUserArgs = {
userRegisterInput: UserRegisterInput;
};
export type LoginUserArgs = {
userLoginInput: UserLoginInput;
};
export type UpdateUserArgs = {
userUpdateInput: UserUpdateInput;
};
export type ChangePasswordArgs = {
passwordEditInput: PasswordEditInput;
};
// Mutation responses
export type AuthPayload = {
token: string;
user: User;
userId: string;
};
export type UserOperationResponse = OperationResponse & {
user?: User;
};
|