ConceptPortal-public/rsconcept/frontend/src/models/user.ts

62 lines
1.1 KiB
TypeScript
Raw Normal View History

/**
* Module: Models for Users.
*/
import { LibraryItemID } from './library';
2024-05-27 20:42:34 +03:00
/**
* Represents {@link User} identifier type.
*/
export type UserID = number;
/**
* Represents user detailed information.
* Some information should only be accessible to authorized users
*/
export interface IUser {
2024-05-27 20:42:34 +03:00
id: UserID;
username: string;
is_staff: boolean;
email: string;
first_name: string;
last_name: string;
}
/**
* Represents CurrentUser information.
*/
export interface ICurrentUser {
id: UserID | null;
username: string;
is_staff: boolean;
2024-06-03 01:17:27 +03:00
editor: LibraryItemID[];
}
/**
* Represents signup data, used to create new users.
*/
export interface IUserSignupData extends Omit<IUser, 'is_staff' | 'id'> {
password: string;
password2: string;
}
/**
* Represents user profile for viewing and editing {@link IUser}.
*/
export interface IUserProfile extends Omit<IUser, 'is_staff'> {}
/**
* Represents user reference information.
*/
export interface IUserInfo extends Omit<IUserProfile, 'email' | 'username'> {}
2024-05-27 20:42:34 +03:00
/**
* Represents user access mode.
*/
2025-01-15 23:03:35 +03:00
export enum UserRole {
2024-05-27 20:42:34 +03:00
READER = 0,
EDITOR,
OWNER,
ADMIN
}