shared-ritm 1.2.100 → 1.2.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/shared-ritm.es.js +3426 -3406
  3. package/dist/shared-ritm.umd.js +146 -146
  4. package/dist/types/api/services/ComentsServise.d.ts +10 -0
  5. package/dist/types/api/services/EquipmentService.d.ts +15 -0
  6. package/dist/types/api/services/PhotoService.d.ts +51 -38
  7. package/dist/types/api/services/SearchService.d.ts +2 -1
  8. package/dist/types/api/types/Api_Equipment.d.ts +2 -0
  9. package/dist/types/api/types/Api_Search.d.ts +9 -0
  10. package/dist/types/api/types/Api_Users.d.ts +43 -0
  11. package/dist/types/index.d.ts +3 -1
  12. package/package.json +64 -64
  13. package/src/api/services/EquipmentService.ts +29 -0
  14. package/src/api/services/InstrumentsService.ts +22 -22
  15. package/src/api/services/SearchService.ts +4 -1
  16. package/src/api/services/UserService.ts +101 -101
  17. package/src/api/services/VideoService.ts +62 -62
  18. package/src/api/settings/ApiService.ts +123 -123
  19. package/src/api/types/Api_Equipment.ts +3 -0
  20. package/src/api/types/Api_Instruments.ts +98 -98
  21. package/src/api/types/Api_Search.ts +10 -0
  22. package/src/api/types/Api_User.ts +117 -117
  23. package/src/api/types/Api_Video.ts +123 -123
  24. package/src/common/app-input-new/AppInputNew.vue +167 -167
  25. package/src/common/app-layout/components/AppLayoutHeader.vue +250 -250
  26. package/src/common/app-sheet/AppSheet.vue +1 -1
  27. package/src/common/app-sheet-new/AppSheetNew.vue +246 -246
  28. package/src/common/app-table/AppTable.vue +312 -312
  29. package/src/common/app-table/AppTableLayout.vue +137 -137
  30. package/src/common/app-table/components/ModalSelect.vue +270 -270
  31. package/src/common/app-table/components/TableModal.vue +356 -356
  32. package/src/common/app-table/controllers/useBaseTable.ts +45 -45
  33. package/src/index.ts +116 -113
  34. package/src/styles/variables.sass +12 -12
@@ -0,0 +1,10 @@
1
+ import ApiService from '@/api/settings/ApiService'
2
+ import { Api_Comment_Request_Dto } from '@/api/types/Api_Comment'
3
+ import { Api_Tasks_Task_Dto } from '@/api/types/Api_Tasks'
4
+ declare class CommentsService extends ApiService {
5
+ uploadComment(payload: Api_Comment_Request_Dto): Promise<Api_Tasks_Task_Dto>
6
+ deleteComment(commentId: string): Promise<unknown>
7
+ editComment(payload: { commentId: string; data: unknown }): Promise<unknown>
8
+ }
9
+ export default function useCommentsService(): CommentsService
10
+ export {}
@@ -0,0 +1,15 @@
1
+ import ApiService from '../settings/ApiService';
2
+ import { ResponseApi } from '../types/Api_Service';
3
+ import { Api_Equipment_Full_Dto } from '@/api/types/Api_Repairs';
4
+ import { Api_Equipment_Create } from '@/api/types/Api_Equipment';
5
+ declare class EquipmentService extends ApiService {
6
+ fetchEquipment(params: any): Promise<ResponseApi<Api_Equipment_Full_Dto[]>>;
7
+ createEquipment(body: Api_Equipment_Create): Promise<Api_Equipment_Full_Dto>;
8
+ editEquipment(id: string, body: Partial<Api_Equipment_Create>): Promise<Api_Equipment_Full_Dto>;
9
+ deleteEquipment(id: string): Promise<{
10
+ data: boolean;
11
+ status: number;
12
+ }>;
13
+ }
14
+ export default function useEquipmentService(): EquipmentService;
15
+ export {};
@@ -1,40 +1,53 @@
1
- import * as faceapi from 'face-api.js';
1
+ import * as faceapi from 'face-api.js'
2
2
  declare class PhotoService {
3
- getVideoStreamConfig(width: number, height: number): {
4
- audio: boolean;
5
- video: {
6
- width: {
7
- min: number;
8
- ideal: number;
9
- };
10
- height: {
11
- min: number;
12
- ideal: number;
13
- };
14
- facingMode: string;
15
- };
16
- };
17
- getContourCoordinate(width: number, height: number): {
18
- x: number;
19
- y: number;
20
- width: number;
21
- height: number;
22
- };
23
- getBoxData(box: any): {
24
- x: any;
25
- y: any;
26
- width: any;
27
- height: any;
28
- } | null;
29
- setStylesForCanvas(canvasContainer: any): void;
30
- checkFaceInclusion(frame: any, face: any): boolean;
31
- getFaceDetections(videoRef: any): Promise<faceapi.WithFaceExpressions<faceapi.WithFaceLandmarks<{
32
- detection: faceapi.FaceDetection;
33
- }, faceapi.FaceLandmarks68>>[]>;
34
- getCanvas(videoRef: any): HTMLCanvasElement;
35
- getResizedAndDetection(canvas: any, detections: any, ctx: any, videoWidth: number, videoHeight: number): void;
36
- getFaceSnapshot(inputImage: any, box: any): Promise<string | null>;
37
- initModels(): Promise<void>;
3
+ getVideoStreamConfig(
4
+ width: number,
5
+ height: number,
6
+ ): {
7
+ audio: boolean
8
+ video: {
9
+ width: {
10
+ min: number
11
+ ideal: number
12
+ }
13
+ height: {
14
+ min: number
15
+ ideal: number
16
+ }
17
+ facingMode: string
18
+ }
19
+ }
20
+ getContourCoordinate(
21
+ width: number,
22
+ height: number,
23
+ ): {
24
+ x: number
25
+ y: number
26
+ width: number
27
+ height: number
28
+ }
29
+ getBoxData(box: any): {
30
+ x: any
31
+ y: any
32
+ width: any
33
+ height: any
34
+ } | null
35
+ setStylesForCanvas(canvasContainer: any): void
36
+ checkFaceInclusion(frame: any, face: any): boolean
37
+ getFaceDetections(videoRef: any): Promise<
38
+ faceapi.WithFaceExpressions<
39
+ faceapi.WithFaceLandmarks<
40
+ {
41
+ detection: faceapi.FaceDetection
42
+ },
43
+ faceapi.FaceLandmarks68
44
+ >
45
+ >[]
46
+ >
47
+ getCanvas(videoRef: any): HTMLCanvasElement
48
+ getResizedAndDetection(canvas: any, detections: any, ctx: any, videoWidth: number, videoHeight: number): void
49
+ getFaceSnapshot(inputImage: any, box: any): Promise<string | null>
50
+ initModels(): Promise<void>
38
51
  }
39
- export default function usePhotoService(): PhotoService;
40
- export {};
52
+ export default function usePhotoService(): PhotoService
53
+ export {}
@@ -1,8 +1,9 @@
1
1
  import ApiService from '../settings/ApiService';
2
2
  import { ResponseApi } from '../types/Api_Service';
3
- import { Api_Search_User } from '../types/Api_Search';
3
+ import { Api_Search_User, Api_Search_Instruments } from '../types/Api_Search';
4
4
  declare class SearchService extends ApiService {
5
5
  fetchSearchUsers(params: any): Promise<ResponseApi<Api_Search_User[]>>;
6
+ fetchSearchInstruments(params: any): Promise<ResponseApi<Api_Search_Instruments[]>>;
6
7
  }
7
8
  export default function useSearchService(): SearchService;
8
9
  export {};
@@ -0,0 +1,2 @@
1
+ import { Api_Equipment_Full_Dto } from '@/api/types/Api_Repairs';
2
+ export type Api_Equipment_Create = Omit<Api_Equipment_Full_Dto, 'id'>;
@@ -41,3 +41,12 @@ export type Api_Search_User = {
41
41
  teams: Api_Search_User_Teams[];
42
42
  photos: Api_Search_User_Photos[];
43
43
  };
44
+ export type Api_Search_Instruments = {
45
+ id: string;
46
+ full_name: string;
47
+ last_name: string;
48
+ first_name: string;
49
+ patronymic: string;
50
+ divisions: string;
51
+ personnel_number: string;
52
+ };
@@ -0,0 +1,43 @@
1
+ export type Api_Search_User_Passes = {
2
+ id: string
3
+ type: string
4
+ uuid: string
5
+ }
6
+ export type Api_Search_User_Positions = {
7
+ id: string
8
+ name: string
9
+ display_name: string
10
+ description: string
11
+ }
12
+ export type Api_Search_User_Roles = {
13
+ id: string
14
+ name: string
15
+ display_name: string
16
+ }
17
+ export type Api_Search_User_Teams = {
18
+ id: string
19
+ name: string
20
+ display_name: string
21
+ roles: Api_Search_User_Roles[]
22
+ }
23
+ export type Api_Search_User_Photos = {
24
+ id: string
25
+ name: string
26
+ path: string
27
+ type: string
28
+ }
29
+ export type Api_Search_User = {
30
+ id: string
31
+ full_name: string
32
+ last_name: string
33
+ first_name: string
34
+ patronymic: string
35
+ email: string
36
+ phone: string
37
+ divisions: string
38
+ personnel_number: string
39
+ passes: Api_Search_User_Passes[]
40
+ positions: Api_Search_User_Positions[]
41
+ teams: Api_Search_User_Teams[]
42
+ photos: Api_Search_User_Photos[]
43
+ }
@@ -38,9 +38,10 @@ import useInstrumentsService from './api/services/InstrumentsService';
38
38
  import useControlsService from './api/services/ControlsService';
39
39
  import useSearchService from './api/services/SearchService';
40
40
  import useCommentsService from './api/services/CommentsService';
41
+ import useEquipmentService from './api/services/EquipmentService';
41
42
  import useFaceApiHelper from './utils/faceApiHelper';
42
43
  export { AppButton, AppCheckbox, AppDatepicker, AppDatePicker, AppInput, AppInputNew, AppInputSearch, AppLayout, AppLayoutHeader, AppLayoutPage, AppLoader, AppSelect, AppSheet, AppSheetNew, AppSidebar, AppToggle, AppWrapper, AppConfirmDialog, AppDropdown, AppTablePagination, AppTableSearch, AppTableModal, AppTable, AppTableLayout, AppModalSelect, };
43
- export { ApiService, useAuthService, useGanttService, useMetricsService, useProjectsService, useRepairsService, useTasksService, useFileService, useControlsService, useVideoService, useUserService, useInstrumentsService, useSearchService, useCommentsService, useFaceApiHelper, };
44
+ export { ApiService, useAuthService, useGanttService, useMetricsService, useProjectsService, useRepairsService, useTasksService, useFileService, useControlsService, useVideoService, useUserService, useInstrumentsService, useSearchService, useCommentsService, useFaceApiHelper, useEquipmentService, };
44
45
  export { useBaseTable } from './common/app-table/controllers/useBaseTable';
45
46
  export { useTableModel } from './common/app-table/controllers/useTableModel';
46
47
  export { useColumnSelector } from './common/app-table/controllers/useColumnSelector';
@@ -59,3 +60,4 @@ export * from './api/types/Api_User';
59
60
  export * from './api/types/Api_Comment';
60
61
  export * from './api/types/Api_Files';
61
62
  export * from './api/types/Api_Video';
63
+ export * from './api/types/Api_Equipment';
package/package.json CHANGED
@@ -1,64 +1,64 @@
1
- {
2
- "name": "shared-ritm",
3
- "version": "1.2.100",
4
- "private": false,
5
- "files": [
6
- "dist",
7
- "src"
8
- ],
9
- "main": "dist/shared-ritm.umd.js",
10
- "type": "module",
11
- "module": "./dist/shared-ritm.es.js",
12
- "types": "./dist/types/index.d.ts",
13
- "exports": {
14
- ".": {
15
- "import": "./dist/shared-ritm.es.js",
16
- "require": "./dist/shared-ritm.umd.js",
17
- "default": "./dist/shared-ritm.es.js",
18
- "types": "./dist/types/index.d.ts"
19
- },
20
- "./style": "./dist/index.css"
21
- },
22
- "scripts": {
23
- "dev": "vite",
24
- "build": "vite build && tsc --emitDeclarationOnly",
25
- "typecheck": "vue-tsc --noEmit",
26
- "lint": "eslint --fix",
27
- "format": "prettier -w -u ."
28
- },
29
- "dependencies": {
30
- "@quasar/extras": "^1.16.17",
31
- "@vueuse/core": "^10.1.2",
32
- "face-api.js": "^0.22.2",
33
- "axios": "^1.7.7",
34
- "vue": "^3.5.12",
35
- "vue-router": "^4.0.3"
36
- },
37
- "peerDependencies": {
38
- "quasar": "^2.18.1"
39
- },
40
- "devDependencies": {
41
- "@quasar/vite-plugin": "^1.9.0",
42
- "@rollup/pluginutils": "^5.1.3",
43
- "@types/node": "^22.7.9",
44
- "@typescript-eslint/eslint-plugin": "^4.25.0",
45
- "@typescript-eslint/parser": "^4.25.0",
46
- "@vitejs/plugin-vue": "^5.1.4",
47
- "@vue/compiler-sfc": "^3.0.5",
48
- "@vue/eslint-config-prettier": "^6.0.0",
49
- "@vue/eslint-config-typescript": "^7.0.0",
50
- "eslint": "^7.27.0",
51
- "eslint-plugin-prettier": "^3.4.0",
52
- "eslint-plugin-vue": "^7.10.0",
53
- "install": "^0.13.0",
54
- "npm": "^11.4.0",
55
- "prettier": "^2.3.0",
56
- "quasar": "^2.18.1",
57
- "rollup-plugin-visualizer": "^5.14.0",
58
- "sass": "^1.80.4",
59
- "typescript": "^5.6.3",
60
- "vite": "^5.4.9",
61
- "vite-plugin-css-modules": "^0.0.1",
62
- "vue-tsc": "^2.1.6"
63
- }
64
- }
1
+ {
2
+ "name": "shared-ritm",
3
+ "version": "1.2.102",
4
+ "private": false,
5
+ "files": [
6
+ "dist",
7
+ "src"
8
+ ],
9
+ "main": "dist/shared-ritm.umd.js",
10
+ "type": "module",
11
+ "module": "./dist/shared-ritm.es.js",
12
+ "types": "./dist/types/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/shared-ritm.es.js",
16
+ "require": "./dist/shared-ritm.umd.js",
17
+ "default": "./dist/shared-ritm.es.js",
18
+ "types": "./dist/types/index.d.ts"
19
+ },
20
+ "./style": "./dist/index.css"
21
+ },
22
+ "scripts": {
23
+ "dev": "vite",
24
+ "build": "vite build && tsc --emitDeclarationOnly",
25
+ "typecheck": "vue-tsc --noEmit",
26
+ "lint": "eslint --fix",
27
+ "format": "prettier -w -u ."
28
+ },
29
+ "dependencies": {
30
+ "@quasar/extras": "^1.16.17",
31
+ "@vueuse/core": "^10.1.2",
32
+ "face-api.js": "^0.22.2",
33
+ "axios": "^1.7.7",
34
+ "vue": "^3.5.12",
35
+ "vue-router": "^4.0.3"
36
+ },
37
+ "peerDependencies": {
38
+ "quasar": "^2.18.1"
39
+ },
40
+ "devDependencies": {
41
+ "@quasar/vite-plugin": "^1.9.0",
42
+ "@rollup/pluginutils": "^5.1.3",
43
+ "@types/node": "^22.7.9",
44
+ "@typescript-eslint/eslint-plugin": "^4.25.0",
45
+ "@typescript-eslint/parser": "^4.25.0",
46
+ "@vitejs/plugin-vue": "^5.1.4",
47
+ "@vue/compiler-sfc": "^3.0.5",
48
+ "@vue/eslint-config-prettier": "^6.0.0",
49
+ "@vue/eslint-config-typescript": "^7.0.0",
50
+ "eslint": "^7.27.0",
51
+ "eslint-plugin-prettier": "^3.4.0",
52
+ "eslint-plugin-vue": "^7.10.0",
53
+ "install": "^0.13.0",
54
+ "npm": "^11.4.0",
55
+ "prettier": "^2.3.0",
56
+ "quasar": "^2.18.1",
57
+ "rollup-plugin-visualizer": "^5.14.0",
58
+ "sass": "^1.80.4",
59
+ "typescript": "^5.6.3",
60
+ "vite": "^5.4.9",
61
+ "vite-plugin-css-modules": "^0.0.1",
62
+ "vue-tsc": "^2.1.6"
63
+ }
64
+ }
@@ -0,0 +1,29 @@
1
+ import ApiService from '../settings/ApiService'
2
+ import { ResponseApi } from '../types/Api_Service'
3
+ import { Api_Equipment_Full_Dto } from '@/api/types/Api_Repairs'
4
+ import { Api_Equipment_Create } from '@/api/types/Api_Equipment'
5
+
6
+ class EquipmentService extends ApiService {
7
+ public fetchEquipment(params: any): Promise<ResponseApi<Api_Equipment_Full_Dto[]>> {
8
+ return this.get<ResponseApi<Api_Equipment_Full_Dto[]>>('repairs/equipment/list', { params })
9
+ }
10
+
11
+ public createEquipment(body: Api_Equipment_Create): Promise<Api_Equipment_Full_Dto> {
12
+ return this.post<Api_Equipment_Create, Api_Equipment_Full_Dto>('repairs/equipment', body)
13
+ }
14
+
15
+ public editEquipment(id: string, body: Partial<Api_Equipment_Create>): Promise<Api_Equipment_Full_Dto> {
16
+ return this.put<Partial<Api_Equipment_Create>, Api_Equipment_Full_Dto>(`repairs/equipment/${id}`, body)
17
+ }
18
+
19
+ public deleteEquipment(id: string): Promise<{ data: boolean; status: number }> {
20
+ return this.delete(`repairs/equipment/${id}`)
21
+ }
22
+ }
23
+
24
+ let api: EquipmentService
25
+
26
+ export default function useEquipmentService() {
27
+ if (!api) api = new EquipmentService()
28
+ return api
29
+ }
@@ -1,22 +1,22 @@
1
- import ApiService from '../settings/ApiService'
2
- import { Api_instruments_HistoryResponse } from '../types/Api_Instruments'
3
-
4
- class InstrumentsService extends ApiService {
5
- public async fetchUserInstrumentsHistory(id: string, page?: number): Promise<Api_instruments_HistoryResponse> {
6
- const params = {
7
- status: 'issued',
8
- page,
9
- desc: 'desc',
10
- column: 'issued_in',
11
- }
12
-
13
- return await this.get(`users/${id}/instruments`, { params })
14
- }
15
- }
16
-
17
- let api: InstrumentsService
18
-
19
- export default function useInstrumentsService() {
20
- if (!api) api = new InstrumentsService()
21
- return api
22
- }
1
+ import ApiService from '../settings/ApiService'
2
+ import { Api_instruments_HistoryResponse } from '../types/Api_Instruments'
3
+
4
+ class InstrumentsService extends ApiService {
5
+ public async fetchUserInstrumentsHistory(id: string, page?: number): Promise<Api_instruments_HistoryResponse> {
6
+ const params = {
7
+ status: 'issued',
8
+ page,
9
+ desc: 'desc',
10
+ column: 'issued_in',
11
+ }
12
+
13
+ return await this.get(`users/${id}/instruments`, { params })
14
+ }
15
+ }
16
+
17
+ let api: InstrumentsService
18
+
19
+ export default function useInstrumentsService() {
20
+ if (!api) api = new InstrumentsService()
21
+ return api
22
+ }
@@ -1,11 +1,14 @@
1
1
  import ApiService from '../settings/ApiService'
2
2
  import { ResponseApi } from '../types/Api_Service'
3
- import { Api_Search_User } from '../types/Api_Search'
3
+ import { Api_Search_User, Api_Search_Instruments } from '../types/Api_Search'
4
4
 
5
5
  class SearchService extends ApiService {
6
6
  public fetchSearchUsers(params: any): Promise<ResponseApi<Api_Search_User[]>> {
7
7
  return this.get<ResponseApi<Api_Search_User[]>>('search/users', { params })
8
8
  }
9
+ public fetchSearchInstruments(params: any): Promise<ResponseApi<Api_Search_Instruments[]>> {
10
+ return this.get<ResponseApi<Api_Search_User[]>>('search/instrument_type', { params })
11
+ }
9
12
  }
10
13
 
11
14
  let api: SearchService
@@ -1,101 +1,101 @@
1
- import ApiService from '../settings/ApiService'
2
- import {
3
- Api_User,
4
- Api_User_Create,
5
- Api_User_Delete_Body,
6
- Api_User_Delete_Photos_Body,
7
- Api_User_Position,
8
- Api_User_Role,
9
- Api_User_Team,
10
- Api_User_Team_Search,
11
- } from '../types/Api_User'
12
- import { ResponseApi } from '../types/Api_Service'
13
-
14
- class UserService extends ApiService {
15
- public async editUser({ id, model }: { id: string; model: any }): Promise<Api_User> {
16
- return await this.put<Partial<Api_User>, Api_User>(`/admin/users/${id}`, model)
17
- }
18
-
19
- public async getUser(id: string): Promise<Api_User> {
20
- return await this.get<Api_User>(`/admin/users/${id}`)
21
- }
22
-
23
- public async createUser(model: Api_User_Create): Promise<Api_User> {
24
- return await this.post<Api_User_Create, Api_User>('/admin/users', model)
25
- }
26
-
27
- public async deleteUser({
28
- user_id,
29
- archive_reason,
30
- }: Api_User_Delete_Body): Promise<{ data: boolean; status: number }> {
31
- return await this.post(`/users/archive_user`, { user_id, archive_reason })
32
- }
33
-
34
- public async deleteUserPhotos({
35
- user_id,
36
- photos,
37
- }: Api_User_Delete_Photos_Body): Promise<{ data: boolean; status: number }> {
38
- return await this.post(`/users/photos/delete`, { user_id, photos })
39
- }
40
-
41
- public async restoreUser(user_id: string): Promise<{ data: boolean; status: number }> {
42
- return await this.post(`/users/restore_user`, { user_id })
43
- }
44
-
45
- public async getRoles(params?: { per_page?: number }): Promise<ResponseApi<Api_User_Role[]>> {
46
- return await this.get<ResponseApi<Api_User_Role[]>>('/search/roles', { params })
47
- }
48
-
49
- public async getPositions(params?: { per_page?: number }): Promise<ResponseApi<Api_User_Position[]>> {
50
- return await this.get<ResponseApi<Api_User_Position[]>>('/search/positions', { params })
51
- }
52
-
53
- public async createPosition(body: Partial<Api_User_Position>): Promise<ResponseApi<Api_User_Position>> {
54
- return await this.post<Partial<Api_User_Position>, ResponseApi<Api_User_Position>>('/admin/positions', body)
55
- }
56
-
57
- public async editPosition(id: string, body: Partial<Api_User_Position>): Promise<ResponseApi<Api_User_Position>> {
58
- return await this.put<Partial<Api_User_Position>, ResponseApi<Api_User_Position>>(`/admin/positions/${id}`, body)
59
- }
60
-
61
- public async deletePosition(id: string): Promise<{ data: boolean; status: number }> {
62
- return await this.delete(`/admin/positions/${id}`)
63
- }
64
-
65
- public async getTeams(params?: { per_page?: number }): Promise<ResponseApi<Api_User_Team_Search[]>> {
66
- return await this.get<ResponseApi<Api_User_Team_Search[]>>('/search/teams', { params })
67
- }
68
-
69
- public async createTeam(body: Partial<Api_User_Team_Search>): Promise<ResponseApi<Api_User_Team>> {
70
- return await this.post<Partial<Api_User_Team_Search>, ResponseApi<Api_User_Team>>('/teams', body)
71
- }
72
-
73
- public async editTeam(id: string, body: Partial<Api_User_Team_Search>): Promise<{ data: boolean; status: number }> {
74
- return await this.patch<Partial<Api_User_Team_Search>, { data: boolean; status: number }>(`/teams/${id}`, body)
75
- }
76
-
77
- public async deleteTeam(id: string): Promise<{ data: boolean; status: number }> {
78
- return await this.delete(`/teams/${id}`)
79
- }
80
-
81
- public async checkUserVectors(id: string): Promise<{ count: number }> {
82
- return await this.get(`/user/get-vectors/${id}`)
83
- }
84
-
85
- public async addUserVectors(formData: FormData): Promise<{ response: string }> {
86
- return await this.post(`/user/add-vector`, formData, {
87
- headers: { 'Content-Type': 'multipart/form-data' },
88
- })
89
- }
90
-
91
- public async removeUserVectors(id: string): Promise<unknown> {
92
- return await this.delete(`/user/delete-vectors/${id}`)
93
- }
94
- }
95
-
96
- let api: UserService
97
-
98
- export default function useUserService() {
99
- if (!api) api = new UserService()
100
- return api
101
- }
1
+ import ApiService from '../settings/ApiService'
2
+ import {
3
+ Api_User,
4
+ Api_User_Create,
5
+ Api_User_Delete_Body,
6
+ Api_User_Delete_Photos_Body,
7
+ Api_User_Position,
8
+ Api_User_Role,
9
+ Api_User_Team,
10
+ Api_User_Team_Search,
11
+ } from '../types/Api_User'
12
+ import { ResponseApi } from '../types/Api_Service'
13
+
14
+ class UserService extends ApiService {
15
+ public async editUser({ id, model }: { id: string; model: any }): Promise<Api_User> {
16
+ return await this.put<Partial<Api_User>, Api_User>(`/admin/users/${id}`, model)
17
+ }
18
+
19
+ public async getUser(id: string): Promise<Api_User> {
20
+ return await this.get<Api_User>(`/admin/users/${id}`)
21
+ }
22
+
23
+ public async createUser(model: Api_User_Create): Promise<Api_User> {
24
+ return await this.post<Api_User_Create, Api_User>('/admin/users', model)
25
+ }
26
+
27
+ public async deleteUser({
28
+ user_id,
29
+ archive_reason,
30
+ }: Api_User_Delete_Body): Promise<{ data: boolean; status: number }> {
31
+ return await this.post(`/users/archive_user`, { user_id, archive_reason })
32
+ }
33
+
34
+ public async deleteUserPhotos({
35
+ user_id,
36
+ photos,
37
+ }: Api_User_Delete_Photos_Body): Promise<{ data: boolean; status: number }> {
38
+ return await this.post(`/users/photos/delete`, { user_id, photos })
39
+ }
40
+
41
+ public async restoreUser(user_id: string): Promise<{ data: boolean; status: number }> {
42
+ return await this.post(`/users/restore_user`, { user_id })
43
+ }
44
+
45
+ public async getRoles(params?: { per_page?: number }): Promise<ResponseApi<Api_User_Role[]>> {
46
+ return await this.get<ResponseApi<Api_User_Role[]>>('/search/roles', { params })
47
+ }
48
+
49
+ public async getPositions(params?: { per_page?: number }): Promise<ResponseApi<Api_User_Position[]>> {
50
+ return await this.get<ResponseApi<Api_User_Position[]>>('/search/positions', { params })
51
+ }
52
+
53
+ public async createPosition(body: Partial<Api_User_Position>): Promise<ResponseApi<Api_User_Position>> {
54
+ return await this.post<Partial<Api_User_Position>, ResponseApi<Api_User_Position>>('/admin/positions', body)
55
+ }
56
+
57
+ public async editPosition(id: string, body: Partial<Api_User_Position>): Promise<ResponseApi<Api_User_Position>> {
58
+ return await this.put<Partial<Api_User_Position>, ResponseApi<Api_User_Position>>(`/admin/positions/${id}`, body)
59
+ }
60
+
61
+ public async deletePosition(id: string): Promise<{ data: boolean; status: number }> {
62
+ return await this.delete(`/admin/positions/${id}`)
63
+ }
64
+
65
+ public async getTeams(params?: { per_page?: number }): Promise<ResponseApi<Api_User_Team_Search[]>> {
66
+ return await this.get<ResponseApi<Api_User_Team_Search[]>>('/search/teams', { params })
67
+ }
68
+
69
+ public async createTeam(body: Partial<Api_User_Team_Search>): Promise<ResponseApi<Api_User_Team>> {
70
+ return await this.post<Partial<Api_User_Team_Search>, ResponseApi<Api_User_Team>>('/teams', body)
71
+ }
72
+
73
+ public async editTeam(id: string, body: Partial<Api_User_Team_Search>): Promise<{ data: boolean; status: number }> {
74
+ return await this.patch<Partial<Api_User_Team_Search>, { data: boolean; status: number }>(`/teams/${id}`, body)
75
+ }
76
+
77
+ public async deleteTeam(id: string): Promise<{ data: boolean; status: number }> {
78
+ return await this.delete(`/teams/${id}`)
79
+ }
80
+
81
+ public async checkUserVectors(id: string): Promise<{ count: number }> {
82
+ return await this.get(`/user/get-vectors/${id}`)
83
+ }
84
+
85
+ public async addUserVectors(formData: FormData): Promise<{ response: string }> {
86
+ return await this.post(`/user/add-vector`, formData, {
87
+ headers: { 'Content-Type': 'multipart/form-data' },
88
+ })
89
+ }
90
+
91
+ public async removeUserVectors(id: string): Promise<unknown> {
92
+ return await this.delete(`/user/delete-vectors/${id}`)
93
+ }
94
+ }
95
+
96
+ let api: UserService
97
+
98
+ export default function useUserService() {
99
+ if (!api) api = new UserService()
100
+ return api
101
+ }