rate/core/src/user.ts

36 lines
664 B
TypeScript

import { EntityInfo } from './entity';
export enum UserRoles {
ADMIN = 'ADMIN',
USER = 'USER',
}
export type UserInfo = {
uuid: string;
username: string;
role: keyof typeof UserRoles;
};
export type User = UserInfo & EntityInfo;
export type UserCtor = Partial<User>;
export type UserInfoWithPassword = {
password: string;
} & UserInfo;
export type UserWithPassword = UserInfoWithPassword & EntityInfo;
export type UserWithPasswordCtor = Partial<UserWithPassword>;
export type CreateUserBody = {
username: string;
password: string;
role: keyof typeof UserRoles;
};
export type LoginUserBody = {
username: string;
password: string;
};