feat: nested department sections, attaching department sections in the user editor

This commit is contained in:
2025-01-19 12:02:35 +04:00
parent 58ab96bdb1
commit 9dab596e87
34 changed files with 1023 additions and 488 deletions

View File

@@ -186,6 +186,7 @@ export type { DeleteUserResponse } from './models/DeleteUserResponse';
export type { DepartmentBaseSchema } from './models/DepartmentBaseSchema';
export type { DepartmentSchema } from './models/DepartmentSchema';
export type { DepartmentSectionBaseSchema } from './models/DepartmentSectionBaseSchema';
export type { DepartmentSectionBriefSchema } from './models/DepartmentSectionBriefSchema';
export type { DepartmentSectionSchema } from './models/DepartmentSectionSchema';
export type { FinishPauseByShiftIdResponse } from './models/FinishPauseByShiftIdResponse';
export type { FinishPauseByUserIdResponse } from './models/FinishPauseByUserIdResponse';
@@ -215,6 +216,7 @@ export type { GetClientMarketplacesResponse } from './models/GetClientMarketplac
export type { GetDealBillById } from './models/GetDealBillById';
export type { GetDealProductsBarcodesPdfRequest } from './models/GetDealProductsBarcodesPdfRequest';
export type { GetDealProductsBarcodesPdfResponse } from './models/GetDealProductsBarcodesPdfResponse';
export type { GetDepartmentSectionsResponse } from './models/GetDepartmentSectionsResponse';
export type { GetDepartmentsResponse } from './models/GetDepartmentsResponse';
export type { GetManagersResponse } from './models/GetManagersResponse';
export type { GetPaymentRecordsResponse } from './models/GetPaymentRecordsResponse';
@@ -350,10 +352,14 @@ export type { UpdateTransactionResponse } from './models/UpdateTransactionRespon
export type { UpdateTransactionSchema } from './models/UpdateTransactionSchema';
export type { UpdateTransactionTagRequest } from './models/UpdateTransactionTagRequest';
export type { UpdateTransactionTagResponse } from './models/UpdateTransactionTagResponse';
export type { UpdateUserDepartmentSectionsRequest } from './models/UpdateUserDepartmentSectionsRequest';
export type { UpdateUserDepartmentSectionsResponse } from './models/UpdateUserDepartmentSectionsResponse';
export type { UpdateUserRequest } from './models/UpdateUserRequest';
export type { UpdateUserResponse } from './models/UpdateUserResponse';
export type { UploadPassportImageResponse } from './models/UploadPassportImageResponse';
export type { UserCreate } from './models/UserCreate';
export type { UserDepartmentSectionSchema } from './models/UserDepartmentSectionSchema';
export type { UserDepartmentSectionsSchema } from './models/UserDepartmentSectionsSchema';
export type { UserSchema } from './models/UserSchema';
export type { UserUpdate } from './models/UserUpdate';
export type { ValidationError } from './models/ValidationError';

View File

@@ -5,5 +5,6 @@
export type AddUserRequest = {
userId: number;
sectionId: number;
isChief: boolean;
};

View File

@@ -4,6 +4,7 @@
/* eslint-disable */
export type DepartmentSectionBaseSchema = {
name: string;
departmentId: number;
departmentId: (number | null);
parentDepartmentSectionId: (number | null);
};

View File

@@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type DepartmentSectionBriefSchema = {
name: string;
departmentId: (number | null);
parentDepartmentSectionId: (number | null);
id: number;
};

View File

@@ -2,11 +2,13 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { UserSchema } from './UserSchema';
import type { UserDepartmentSectionSchema } from './UserDepartmentSectionSchema';
export type DepartmentSectionSchema = {
name: string;
departmentId: number;
departmentId: (number | null);
parentDepartmentSectionId: (number | null);
id: number;
users?: Array<UserSchema>;
users?: Array<UserDepartmentSectionSchema>;
sections?: Array<DepartmentSectionSchema>;
};

View File

@@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { DepartmentSectionBriefSchema } from './DepartmentSectionBriefSchema';
export type GetDepartmentSectionsResponse = {
departmentSections: Array<DepartmentSectionBriefSchema>;
};

View File

@@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { UserDepartmentSectionsSchema } from './UserDepartmentSectionsSchema';
export type UpdateUserDepartmentSectionsRequest = {
departmentSections: Array<UserDepartmentSectionsSchema>;
};

View File

@@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type UpdateUserDepartmentSectionsResponse = {
ok: boolean;
message: string;
};

View File

@@ -0,0 +1,10 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { UserSchema } from './UserSchema';
export type UserDepartmentSectionSchema = {
user: UserSchema;
isChief: boolean;
};

View File

@@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type UserDepartmentSectionsSchema = {
sectionId: number;
isChief: boolean;
};

View File

@@ -6,6 +6,7 @@ import type { PassportImageSchema } from './PassportImageSchema';
import type { PayRateSchema } from './PayRateSchema';
import type { PositionSchema } from './PositionSchema';
import type { RoleSchema } from './RoleSchema';
import type { UserDepartmentSectionsSchema } from './UserDepartmentSectionsSchema';
export type UserSchema = {
telegramId: number;
phoneNumber?: (string | null);
@@ -24,5 +25,6 @@ export type UserSchema = {
id: number;
role: RoleSchema;
position?: (PositionSchema | null);
departmentSections?: (Array<UserDepartmentSectionsSchema> | null);
};

View File

@@ -13,6 +13,7 @@ import type { DeleteDepartmentSectionResponse } from '../models/DeleteDepartment
import type { DeleteUserRequest } from '../models/DeleteUserRequest';
import type { DeleteUserResponse } from '../models/DeleteUserResponse';
import type { GetAvailableUsersForDepartmentSectionResponse } from '../models/GetAvailableUsersForDepartmentSectionResponse';
import type { GetDepartmentSectionsResponse } from '../models/GetDepartmentSectionsResponse';
import type { GetDepartmentsResponse } from '../models/GetDepartmentsResponse';
import type { UpdateDepartmentRequest } from '../models/UpdateDepartmentRequest';
import type { UpdateDepartmentResponse } from '../models/UpdateDepartmentResponse';
@@ -94,6 +95,17 @@ export class DepartmentService {
},
});
}
/**
* Get Sections
* @returns GetDepartmentSectionsResponse Successful Response
* @throws ApiError
*/
public static getSections(): CancelablePromise<GetDepartmentSectionsResponse> {
return __request(OpenAPI, {
method: 'GET',
url: '/department/section',
});
}
/**
* Create Section
* @returns CreateDepartmentSectionResponse Successful Response

View File

@@ -7,6 +7,8 @@ import type { CreateUserRequest } from '../models/CreateUserRequest';
import type { CreateUserResponse } from '../models/CreateUserResponse';
import type { GetAllUsersResponse } from '../models/GetAllUsersResponse';
import type { GetManagersResponse } from '../models/GetManagersResponse';
import type { UpdateUserDepartmentSectionsRequest } from '../models/UpdateUserDepartmentSectionsRequest';
import type { UpdateUserDepartmentSectionsResponse } from '../models/UpdateUserDepartmentSectionsResponse';
import type { UpdateUserRequest } from '../models/UpdateUserRequest';
import type { UpdateUserResponse } from '../models/UpdateUserResponse';
import type { UploadPassportImageResponse } from '../models/UploadPassportImageResponse';
@@ -45,6 +47,31 @@ export class UserService {
},
});
}
/**
* Update User Department Sections
* @returns UpdateUserDepartmentSectionsResponse Successful Response
* @throws ApiError
*/
public static updateUserDepartmentSections({
userId,
requestBody,
}: {
userId: number,
requestBody: UpdateUserDepartmentSectionsRequest,
}): CancelablePromise<UpdateUserDepartmentSectionsResponse> {
return __request(OpenAPI, {
method: 'POST',
url: '/user/update/department-sections/{user_id}',
path: {
'user_id': userId,
},
body: requestBody,
mediaType: 'application/json',
errors: {
422: `Validation Error`,
},
});
}
/**
* Create
* @returns CreateUserResponse Successful Response