@things-factory/organization 7.0.70 → 7.0.72
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.
- package/client/component/department-selector.ts +7 -2
- package/client/pages/employee/employee-list-page.ts +39 -5
- package/dist-client/component/department-selector.d.ts +1 -1
- package/dist-client/component/department-selector.js +6 -2
- package/dist-client/component/department-selector.js.map +1 -1
- package/dist-client/pages/employee/employee-list-page.d.ts +1 -0
- package/dist-client/pages/employee/employee-list-page.js +36 -5
- package/dist-client/pages/employee/employee-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/register-employee-as-system-user.d.ts +5 -1
- package/dist-server/controllers/register-employee-as-system-user.js +87 -35
- package/dist-server/controllers/register-employee-as-system-user.js.map +1 -1
- package/dist-server/service/employee/employee-mutation.d.ts +1 -1
- package/dist-server/service/employee/employee-mutation.js +68 -60
- package/dist-server/service/employee/employee-mutation.js.map +1 -1
- package/dist-server/service/employee/employee-query.d.ts +2 -2
- package/dist-server/service/employee/employee-query.js +18 -10
- package/dist-server/service/employee/employee-query.js.map +1 -1
- package/dist-server/service/index.d.ts +3 -3
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/server/controllers/register-employee-as-system-user.ts +111 -37
- package/server/service/employee/employee-mutation.ts +83 -63
- package/server/service/employee/employee-query.ts +23 -12
- package/translations/en.json +5 -1
- package/translations/ja.json +5 -1
- package/translations/ko.json +5 -1
- package/translations/ms.json +4 -1
- package/translations/zh.json +5 -1
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EmployeeQuery = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const graphql_scalars_1 = require("graphql-scalars");
|
|
6
7
|
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
7
8
|
const shell_1 = require("@things-factory/shell");
|
|
8
9
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
@@ -52,25 +53,25 @@ let EmployeeQuery = class EmployeeQuery {
|
|
|
52
53
|
if (!employee.contactId) {
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
55
|
-
await getContactItem(employee.contactId, contact_1.ContactField.Phone, 'work', context);
|
|
56
|
+
return await getContactItem(employee.contactId, contact_1.ContactField.Phone, 'work', context);
|
|
56
57
|
}
|
|
57
58
|
async address(employee, context) {
|
|
58
59
|
if (!employee.contactId) {
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
|
-
await getContactItem(employee.contactId, contact_1.ContactField.Address, 'work', context);
|
|
62
|
+
return await getContactItem(employee.contactId, contact_1.ContactField.Address, 'work', context);
|
|
62
63
|
}
|
|
63
64
|
async email(employee, context) {
|
|
64
65
|
if (!employee.contactId) {
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
|
-
await getContactItem(employee.contactId, contact_1.ContactField.Email, 'work', context);
|
|
68
|
+
return await getContactItem(employee.contactId, contact_1.ContactField.Email, 'work', context);
|
|
68
69
|
}
|
|
69
70
|
async profile(employee) {
|
|
70
71
|
if (!employee.contactId) {
|
|
71
72
|
return;
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
+
let contact = employee.contact;
|
|
74
75
|
if (!contact) {
|
|
75
76
|
contact = await (0, shell_1.getRepository)(contact_1.Contact).findOneBy({
|
|
76
77
|
id: employee.contactId
|
|
@@ -122,7 +123,11 @@ let EmployeeQuery = class EmployeeQuery {
|
|
|
122
123
|
};
|
|
123
124
|
exports.EmployeeQuery = EmployeeQuery;
|
|
124
125
|
tslib_1.__decorate([
|
|
125
|
-
(0, type_graphql_1.
|
|
126
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee", privilege: "query", domainOwnerGranted: true)'),
|
|
127
|
+
(0, type_graphql_1.Query)(returns => employee_1.Employee, {
|
|
128
|
+
nullable: true,
|
|
129
|
+
description: 'Fetches a specific employee by their unique ID. Returns the employee object if found, or null if not found.'
|
|
130
|
+
}),
|
|
126
131
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
127
132
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
128
133
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -130,7 +135,10 @@ tslib_1.__decorate([
|
|
|
130
135
|
tslib_1.__metadata("design:returntype", Promise)
|
|
131
136
|
], EmployeeQuery.prototype, "employee", null);
|
|
132
137
|
tslib_1.__decorate([
|
|
133
|
-
(0, type_graphql_1.
|
|
138
|
+
(0, type_graphql_1.Directive)('@privilege(category: "employee", privilege: "query", domainOwnerGranted: true)'),
|
|
139
|
+
(0, type_graphql_1.Query)(returns => employee_type_1.EmployeeList, {
|
|
140
|
+
description: 'Fetches a list of employees based on provided query parameters. Supports searching by name, control number, and alias.'
|
|
141
|
+
}),
|
|
134
142
|
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
135
143
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
136
144
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -138,14 +146,14 @@ tslib_1.__decorate([
|
|
|
138
146
|
tslib_1.__metadata("design:returntype", Promise)
|
|
139
147
|
], EmployeeQuery.prototype, "employees", null);
|
|
140
148
|
tslib_1.__decorate([
|
|
141
|
-
(0, type_graphql_1.FieldResolver)(type => String),
|
|
149
|
+
(0, type_graphql_1.FieldResolver)(type => String, { nullable: true }),
|
|
142
150
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
143
151
|
tslib_1.__metadata("design:type", Function),
|
|
144
152
|
tslib_1.__metadata("design:paramtypes", [employee_1.Employee]),
|
|
145
153
|
tslib_1.__metadata("design:returntype", Promise)
|
|
146
154
|
], EmployeeQuery.prototype, "photo", null);
|
|
147
155
|
tslib_1.__decorate([
|
|
148
|
-
(0, type_graphql_1.FieldResolver)(type => String),
|
|
156
|
+
(0, type_graphql_1.FieldResolver)(type => String, { nullable: true }),
|
|
149
157
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
150
158
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
151
159
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -153,7 +161,7 @@ tslib_1.__decorate([
|
|
|
153
161
|
tslib_1.__metadata("design:returntype", Promise)
|
|
154
162
|
], EmployeeQuery.prototype, "phone", null);
|
|
155
163
|
tslib_1.__decorate([
|
|
156
|
-
(0, type_graphql_1.FieldResolver)(type => String),
|
|
164
|
+
(0, type_graphql_1.FieldResolver)(type => String, { nullable: true }),
|
|
157
165
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
158
166
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
159
167
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -161,7 +169,7 @@ tslib_1.__decorate([
|
|
|
161
169
|
tslib_1.__metadata("design:returntype", Promise)
|
|
162
170
|
], EmployeeQuery.prototype, "address", null);
|
|
163
171
|
tslib_1.__decorate([
|
|
164
|
-
(0, type_graphql_1.FieldResolver)(type =>
|
|
172
|
+
(0, type_graphql_1.FieldResolver)(type => graphql_scalars_1.GraphQLEmailAddress, { nullable: true }),
|
|
165
173
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
166
174
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
167
175
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"employee-query.js","sourceRoot":"","sources":["../../../server/service/employee/employee-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qEAA4D;AAC5D,iDAAuG;AACvG,yDAAgD;AAChD,qDAAqF;AACrF,yCAAqC;AACrC,mDAA8C;AAC9C,yDAAqD;AAErD,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,IAAY,EAAE,KAAa,EAAE,OAAwB;;IACpG,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KA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AAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CA4BvC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,uBAAU,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;+CAI1C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;yCAIpC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,mBAAQ,CAAC;IACd,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;+CAI1C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAO,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAIvC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;2CAEtC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAEvC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAEvC;wBA1IU,aAAa;IADzB,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,aAAa,CA2IzB","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Contact, ContactItem, ContactField, Profile } from '@things-factory/contact'\nimport { Employee } from './employee'\nimport { EmployeeList } from './employee-type'\nimport { Department } from '../department/department'\n\nasync function getContactItem(contactId: string, type: string, label: string, context: ResolverContext) {\n const { domain } = context.state\n const contact: Contact = await getRepository(Contact).findOne({ where: { domain: { id: domain.id }, id: contactId } })\n const { items } = contact\n\n if (!items || !(items instanceof Array)) {\n return ''\n }\n\n return items?.find(item => item.type === type && item.label === label)?.value || ''\n}\n@Resolver(Employee)\nexport class EmployeeQuery {\n @Query(returns => Employee!, { nullable: true, description: 'To fetch a Employee' })\n async employee(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Employee> {\n const { domain } = context.state\n\n return await getRepository(Employee).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => EmployeeList, { description: 'To fetch multiple Employees' })\n async employees(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<EmployeeList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Employee),\n searchables: ['name', 'controlNo', 'alias']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String)\n async photo(@Root() employee: Employee): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: employee.domainId },\n refType: Employee.name,\n refBy: employee.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => String)\n async phone(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string> {\n if (!employee.contactId) {\n return\n }\n\n await getContactItem(employee.contactId, ContactField.Phone, 'work', context)\n }\n\n @FieldResolver(type => String)\n async address(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string> {\n if (!employee.contactId) {\n return\n }\n\n await getContactItem(employee.contactId, ContactField.Address, 'work', context)\n }\n\n @FieldResolver(type => String)\n async email(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string> {\n if (!employee.contactId) {\n return\n }\n\n await getContactItem(employee.contactId, ContactField.Email, 'work', context)\n }\n\n @FieldResolver(type => Profile)\n async profile(@Root() employee: Employee): Promise<Profile> {\n if (!employee.contactId) {\n return\n }\n\n var contact: Contact = employee.contact\n if (!contact) {\n contact = await getRepository(Contact).findOneBy({\n id: employee.contactId\n })\n\n if (!contact) {\n return\n }\n }\n\n const { id: refBy } = contact\n const { left, top, zoom } = contact.profile || {}\n\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: contact.domainId },\n refType: Contact.name,\n refBy\n }\n })\n\n return { left, top, zoom, picture: attachment?.fullpath }\n }\n\n @FieldResolver(type => Department)\n async department(@Root() employee: Employee): Promise<Department> {\n if (employee.departmentId) {\n return await getRepository(Department).findOneBy({ id: employee.departmentId })\n }\n }\n\n @FieldResolver(type => User)\n async user(@Root() employee: Employee): Promise<User> {\n if (employee.userId) {\n return await getRepository(User).findOneBy({ id: employee.userId })\n }\n }\n\n @FieldResolver(type => Employee)\n async supervisor(@Root() employee: Employee): Promise<Employee> {\n if (employee.supervisorId) {\n return await getRepository(Employee).findOneBy({ id: employee.supervisorId })\n }\n }\n\n @FieldResolver(type => Contact)\n async contact(@Root() employee: Employee): Promise<Contact> {\n if (employee.contactId) {\n return await getRepository(Contact).findOneBy({ id: employee.contactId })\n }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() employee: Employee): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: employee.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() employee: Employee): Promise<User> {\n return await getRepository(User).findOneBy({ id: employee.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() employee: Employee): Promise<User> {\n return await getRepository(User).findOneBy({ id: employee.creatorId })\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"employee-query.js","sourceRoot":"","sources":["../../../server/service/employee/employee-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qDAAqD;AACrD,qEAA4D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AAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAEvC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAEvC;wBAnJU,aAAa;IADzB,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,aAAa,CAoJzB","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Contact, ContactItem, ContactField, Profile } from '@things-factory/contact'\nimport { Employee } from './employee'\nimport { EmployeeList } from './employee-type'\nimport { Department } from '../department/department'\n\nasync function getContactItem(contactId: string, type: string, label: string, context: ResolverContext) {\n const { domain } = context.state\n const contact: Contact = await getRepository(Contact).findOne({ where: { domain: { id: domain.id }, id: contactId } })\n const { items } = contact\n\n if (!items || !(items instanceof Array)) {\n return ''\n }\n\n return items?.find(item => item.type === type && item.label === label)?.value || ''\n}\n\n@Resolver(Employee)\nexport class EmployeeQuery {\n @Directive('@privilege(category: \"employee\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => Employee!, {\n nullable: true,\n description:\n 'Fetches a specific employee by their unique ID. Returns the employee object if found, or null if not found.'\n })\n async employee(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Employee> {\n const { domain } = context.state\n\n return await getRepository(Employee).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Directive('@privilege(category: \"employee\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => EmployeeList, {\n description:\n 'Fetches a list of employees based on provided query parameters. Supports searching by name, control number, and alias.'\n })\n async employees(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<EmployeeList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Employee),\n searchables: ['name', 'controlNo', 'alias']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String, { nullable: true })\n async photo(@Root() employee: Employee): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: employee.domainId },\n refType: Employee.name,\n refBy: employee.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => String, { nullable: true })\n async phone(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string> {\n if (!employee.contactId) {\n return\n }\n\n return await getContactItem(employee.contactId, ContactField.Phone, 'work', context)\n }\n\n @FieldResolver(type => String, { nullable: true })\n async address(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string | undefined> {\n if (!employee.contactId) {\n return\n }\n\n return await getContactItem(employee.contactId, ContactField.Address, 'work', context)\n }\n\n @FieldResolver(type => GraphQLEmailAddress, { nullable: true })\n async email(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string | undefined> {\n if (!employee.contactId) {\n return\n }\n\n return await getContactItem(employee.contactId, ContactField.Email, 'work', context)\n }\n\n @FieldResolver(type => Profile)\n async profile(@Root() employee: Employee): Promise<Profile> {\n if (!employee.contactId) {\n return\n }\n\n let contact: Contact = employee.contact\n if (!contact) {\n contact = await getRepository(Contact).findOneBy({\n id: employee.contactId\n })\n\n if (!contact) {\n return\n }\n }\n\n const { id: refBy } = contact\n const { left, top, zoom } = contact.profile || {}\n\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: contact.domainId },\n refType: Contact.name,\n refBy\n }\n })\n\n return { left, top, zoom, picture: attachment?.fullpath }\n }\n\n @FieldResolver(type => Department)\n async department(@Root() employee: Employee): Promise<Department> {\n if (employee.departmentId) {\n return await getRepository(Department).findOneBy({ id: employee.departmentId })\n }\n }\n\n @FieldResolver(type => User)\n async user(@Root() employee: Employee): Promise<User> {\n if (employee.userId) {\n return await getRepository(User).findOneBy({ id: employee.userId })\n }\n }\n\n @FieldResolver(type => Employee)\n async supervisor(@Root() employee: Employee): Promise<Employee> {\n if (employee.supervisorId) {\n return await getRepository(Employee).findOneBy({ id: employee.supervisorId })\n }\n }\n\n @FieldResolver(type => Contact)\n async contact(@Root() employee: Employee): Promise<Contact> {\n if (employee.contactId) {\n return await getRepository(Contact).findOneBy({ id: employee.contactId })\n }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() employee: Employee): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: employee.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() employee: Employee): Promise<User> {\n return await getRepository(User).findOneBy({ id: employee.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() employee: Employee): Promise<User> {\n return await getRepository(User).findOneBy({ id: employee.creatorId })\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './approval-line/approval-line';
|
|
2
2
|
export * from './department/department';
|
|
3
3
|
export * from './employee/employee';
|
|
4
|
-
export declare const entities: (typeof import("./
|
|
5
|
-
export declare const subscribers: (typeof import("./
|
|
4
|
+
export declare const entities: (typeof import("./department/department").Department | typeof import("./employee/employee").Employee | typeof import("./approval-line/approval-line").ApprovalLine | typeof import("./department/department-history").DepartmentHistory | typeof import("./employee/employee-history").EmployeeHistory)[];
|
|
5
|
+
export declare const subscribers: (typeof import("./department/event-subscriber").DepartmentHistoryEntitySubscriber | typeof import("./employee/event-subscriber").EmployeeHistoryEntitySubscriber)[];
|
|
6
6
|
export declare const schema: {
|
|
7
|
-
resolverClasses: (typeof import("./
|
|
7
|
+
resolverClasses: (typeof import("./approval-line/approval-line-query").ApprovalLineQuery | typeof import("./approval-line/approval-line-mutation").ApprovalLineMutation | typeof import("./department/department-query").DepartmentQuery | typeof import("./department/department-mutation").DepartmentMutation | typeof import("./employee/employee-query").EmployeeQuery | typeof import("./employee/employee-mutation").EmployeeMutation)[];
|
|
8
8
|
};
|