Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

Commit 530edbd

Browse files
committed
feat: Add type field to step schema and update related DTOs; remove organisationId from user-related schemas
1 parent af86324 commit 530edbd

6 files changed

Lines changed: 6 additions & 18 deletions

File tree

src/quest/dto/step.dto.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ export const stepSchema = z.object({
1111
description: z.string().optional(),
1212
status: z.string().min(1, 'Статус этапа обязателен'),
1313
progress: z.number().int().min(0, 'Прогресс должен быть от 0 до 100').max(100, 'Прогресс должен быть от 0 до 100'),
14+
type: z.enum(['finance', 'material', 'contributers'], {
15+
message: 'Тип этапа должен быть одним из: finance, material, contributers',
16+
}),
1417
requirement: requirementSchema,
1518
deadline: z.string().datetime().optional().or(z.date().optional()),
1619
});
@@ -30,6 +33,9 @@ export class StepDtoClass {
3033
@ApiProperty({ description: 'Прогресс выполнения этапа (0-100)', example: 0, minimum: 0, maximum: 100 })
3134
progress: number;
3235

36+
@ApiProperty({ description: 'Тип этапа', example: 'finance', enum: ['finance', 'material', 'contributers'] })
37+
type: 'finance' | 'material' | 'contributers';
38+
3339
@ApiProperty({ description: 'Требование этапа (объект)', example: { currentValue: 0, targetValue: 10 }, required: false })
3440
requirement?: {
3541
currentValue: number;

src/user/dto/create-user.dto.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const createUserSchema = z.object({
1111
role: z.nativeEnum(UserRole, {
1212
message: 'Роль должна быть одним из: USER, ADMIN',
1313
}).optional(),
14-
organisationId: z.number().int().positive('ID организации должен быть положительным числом').nullable().optional(),
1514
});
1615

1716
export type CreateUserDto = z.infer<typeof createUserSchema>;
@@ -34,8 +33,5 @@ export class CreateUserDtoClass {
3433

3534
@ApiProperty({ description: 'Роль пользователя', enum: UserRole, example: UserRole.USER, required: false })
3635
role?: UserRole;
37-
38-
@ApiProperty({ description: 'ID организации', example: 1, required: false, nullable: true })
39-
organisationId?: number | null;
4036
}
4137

src/user/dto/update-user-v2.dto.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const updateUserV2Schema = z.object({
1111
role: z.nativeEnum(UserRole, {
1212
message: 'Роль должна быть одним из: USER, ADMIN',
1313
}).optional(),
14-
organisationId: z.number().int().positive('ID организации должен быть положительным числом').nullable().optional(),
1514
});
1615

1716
export type UpdateUserV2Dto = z.infer<typeof updateUserV2Schema>;
@@ -38,8 +37,5 @@ export class UpdateUserV2DtoClass {
3837

3938
@ApiProperty({ description: 'Роль пользователя', enum: UserRole, example: UserRole.USER, required: false })
4039
role?: UserRole;
41-
42-
@ApiProperty({ description: 'ID организации', example: 1, required: false, nullable: true })
43-
organisationId?: number | null;
4440
}
4541

src/user/dto/update-user.dto.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const updateUserSchema = z.object({
1111
role: z.nativeEnum(UserRole, {
1212
message: 'Роль должна быть одним из: USER, ADMIN',
1313
}).optional(),
14-
organisationId: z.number().int().positive('ID организации должен быть положительным числом').nullable().optional(),
1514
});
1615

1716
export type UpdateUserDto = z.infer<typeof updateUserSchema>;
@@ -38,8 +37,5 @@ export class UpdateUserDtoClass {
3837

3938
@ApiProperty({ description: 'Роль пользователя', enum: UserRole, example: UserRole.USER, required: false })
4039
role?: UserRole;
41-
42-
@ApiProperty({ description: 'ID организации', example: 1, required: false, nullable: true })
43-
organisationId?: number | null;
4440
}
4541

src/user/user.repository.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export class UserRepository {
6363
role: users.role,
6464
level: users.level,
6565
experience: users.experience,
66-
organisationId: users.organisationId,
6766
recordStatus: users.recordStatus,
6867
createdAt: users.createdAt,
6968
updatedAt: users.updatedAt,
@@ -140,7 +139,6 @@ export class UserRepository {
140139
role: users.role,
141140
level: users.level,
142141
experience: users.experience,
143-
organisationId: users.organisationId,
144142
recordStatus: users.recordStatus,
145143
createdAt: users.createdAt,
146144
updatedAt: users.updatedAt,
@@ -210,7 +208,6 @@ export class UserRepository {
210208
role?: string;
211209
level?: number;
212210
experience?: number;
213-
organisationId?: number | null;
214211
}): Promise<typeof users.$inferSelect> {
215212
try {
216213
// Проверяем уникальность email
@@ -231,7 +228,6 @@ export class UserRepository {
231228
role: data.role ?? 'USER',
232229
level: data.level ?? 1,
233230
experience: data.experience ?? 0,
234-
organisationId: data.organisationId ?? null,
235231
})
236232
.returning();
237233

@@ -278,7 +274,6 @@ export class UserRepository {
278274
email: string;
279275
avatarUrls: Record<number, string>;
280276
role: string;
281-
organisationId: number | null;
282277
}>,
283278
): Promise<typeof users.$inferSelect> {
284279
try {

src/user/user.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export class UserService {
7979
role: createUserDto.role,
8080
level: 1,
8181
experience: 0,
82-
organisationId: createUserDto.organisationId,
8382
});
8483

8584
return this.formatUser(user);

0 commit comments

Comments
 (0)