Init
This commit is contained in:
9
frontend/src/app/api/dtos/User/ChangeUserPasswordDto.ts
Normal file
9
frontend/src/app/api/dtos/User/ChangeUserPasswordDto.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export class ChangeUserPasswordDto {
|
||||
currentPassword: string;
|
||||
newPassword: string;
|
||||
|
||||
constructor({ currentPassword, newPassword }: ChangeUserPasswordDto) {
|
||||
this.currentPassword = currentPassword;
|
||||
this.newPassword = newPassword;
|
||||
}
|
||||
}
|
||||
39
frontend/src/app/api/dtos/User/CreateUserDto.ts
Normal file
39
frontend/src/app/api/dtos/User/CreateUserDto.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { Nullable, UserRole } from '@/shared';
|
||||
import type { ObjectPermissionDto } from '../Permission/ObjectPermissionDto';
|
||||
|
||||
export class CreateUserDto {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
email: string;
|
||||
phone: Nullable<string>;
|
||||
password: string;
|
||||
role: UserRole;
|
||||
departmentId: Nullable<number>;
|
||||
position: Nullable<string>;
|
||||
objectPermissions: ObjectPermissionDto[];
|
||||
accessibleUserIds?: Nullable<number[]>;
|
||||
|
||||
constructor({
|
||||
firstName,
|
||||
lastName,
|
||||
email,
|
||||
phone,
|
||||
password,
|
||||
role,
|
||||
departmentId,
|
||||
position,
|
||||
objectPermissions,
|
||||
accessibleUserIds,
|
||||
}: CreateUserDto) {
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
this.email = email;
|
||||
this.phone = phone;
|
||||
this.password = password;
|
||||
this.role = role;
|
||||
this.departmentId = departmentId;
|
||||
this.position = position;
|
||||
this.objectPermissions = objectPermissions;
|
||||
this.accessibleUserIds = accessibleUserIds;
|
||||
}
|
||||
}
|
||||
58
frontend/src/app/api/dtos/User/UpdateUserDto.ts
Normal file
58
frontend/src/app/api/dtos/User/UpdateUserDto.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import type { Nullable, User, UserRole } from '@/shared';
|
||||
import type { ObjectPermissionDto } from '../Permission/ObjectPermissionDto';
|
||||
|
||||
export class UpdateUserDto {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
email: string;
|
||||
phone: Nullable<string>;
|
||||
password: Nullable<string>;
|
||||
role: UserRole;
|
||||
avatarUrl: Nullable<string>;
|
||||
departmentId: Nullable<number>;
|
||||
position: Nullable<string>;
|
||||
objectPermissions: ObjectPermissionDto[];
|
||||
accessibleUserIds?: Nullable<number[]>;
|
||||
|
||||
constructor({
|
||||
firstName,
|
||||
lastName,
|
||||
email,
|
||||
phone,
|
||||
password,
|
||||
role,
|
||||
avatarUrl,
|
||||
departmentId,
|
||||
position,
|
||||
objectPermissions,
|
||||
accessibleUserIds,
|
||||
}: UpdateUserDto) {
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
this.email = email;
|
||||
this.phone = phone;
|
||||
this.password = password;
|
||||
this.role = role;
|
||||
this.avatarUrl = avatarUrl;
|
||||
this.departmentId = departmentId;
|
||||
this.position = position;
|
||||
this.objectPermissions = objectPermissions;
|
||||
this.accessibleUserIds = accessibleUserIds;
|
||||
}
|
||||
|
||||
static fromExistingUser(user: User): UpdateUserDto {
|
||||
return new UpdateUserDto({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName || '',
|
||||
email: user.email,
|
||||
phone: user.phone,
|
||||
password: null,
|
||||
role: user.role,
|
||||
avatarUrl: user.avatarUrl,
|
||||
departmentId: user.departmentId,
|
||||
position: user.position,
|
||||
objectPermissions: user.objectPermissions,
|
||||
accessibleUserIds: user.accessibleUserIds,
|
||||
});
|
||||
}
|
||||
}
|
||||
19
frontend/src/app/api/dtos/User/UserDto.ts
Normal file
19
frontend/src/app/api/dtos/User/UserDto.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { Nullable, UserRole } from '@/shared';
|
||||
import type { ObjectPermissionDto } from '../Permission/ObjectPermissionDto';
|
||||
|
||||
export interface UserDto {
|
||||
id: number;
|
||||
firstName: string;
|
||||
lastName: Nullable<string>;
|
||||
email: string;
|
||||
phone: Nullable<string>;
|
||||
role: UserRole;
|
||||
isActive: boolean;
|
||||
departmentId: Nullable<number>;
|
||||
avatarUrl: Nullable<string>;
|
||||
position: Nullable<string>;
|
||||
objectPermissions?: ObjectPermissionDto[];
|
||||
analyticsId: string;
|
||||
accessibleUserIds: number[];
|
||||
isPlatformAdmin?: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user