@things-factory/organization 6.0.6 → 6.0.8
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/model/contact.ts +0 -2
- package/client/pages/employee/employee-list-page.ts +7 -11
- package/dist-client/model/contact.d.ts +0 -2
- package/dist-client/model/contact.js.map +1 -1
- package/dist-client/pages/employee/employee-list-page.d.ts +2 -2
- package/dist-client/pages/employee/employee-list-page.js +4 -8
- package/dist-client/pages/employee/employee-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/employee/employee-query.js +22 -24
- package/dist-server/service/employee/employee-query.js.map +1 -1
- package/dist-server/service/employee/employee-type.js +4 -0
- package/dist-server/service/employee/employee-type.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/server/service/employee/employee-query.ts +20 -21
- package/server/service/employee/employee-type.ts +3 -0
|
@@ -10,6 +10,16 @@ const contact_1 = require("@things-factory/contact");
|
|
|
10
10
|
const employee_1 = require("./employee");
|
|
11
11
|
const employee_type_1 = require("./employee-type");
|
|
12
12
|
const department_1 = require("../department/department");
|
|
13
|
+
async function getContactItem(contactId, type, label, context) {
|
|
14
|
+
var _a;
|
|
15
|
+
const { domain } = context.state;
|
|
16
|
+
const contact = await (0, shell_1.getRepository)(contact_1.Contact).findOne({ where: { domain: { id: domain.id }, id: contactId } });
|
|
17
|
+
const { items } = contact;
|
|
18
|
+
if (!items || !(items instanceof Array)) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
return ((_a = items === null || items === void 0 ? void 0 : items.find(item => item.type === type && item.label === label)) === null || _a === void 0 ? void 0 : _a.value) || '';
|
|
22
|
+
}
|
|
13
23
|
let EmployeeQuery = class EmployeeQuery {
|
|
14
24
|
async employee(id, context) {
|
|
15
25
|
const { domain } = context.state;
|
|
@@ -38,38 +48,23 @@ let EmployeeQuery = class EmployeeQuery {
|
|
|
38
48
|
});
|
|
39
49
|
return attachment === null || attachment === void 0 ? void 0 : attachment.fullpath;
|
|
40
50
|
}
|
|
41
|
-
async phone(employee) {
|
|
51
|
+
async phone(employee, context) {
|
|
42
52
|
if (!employee.contactId) {
|
|
43
53
|
return;
|
|
44
54
|
}
|
|
45
|
-
|
|
46
|
-
contact: { id: employee.contactId },
|
|
47
|
-
type: contact_1.ContactField.Phone,
|
|
48
|
-
label: 'work'
|
|
49
|
-
}));
|
|
50
|
-
return phone === null || phone === void 0 ? void 0 : phone.value;
|
|
55
|
+
await getContactItem(employee.contactId, contact_1.ContactField.Phone, 'work', context);
|
|
51
56
|
}
|
|
52
|
-
async address(employee) {
|
|
57
|
+
async address(employee, context) {
|
|
53
58
|
if (!employee.contactId) {
|
|
54
59
|
return;
|
|
55
60
|
}
|
|
56
|
-
|
|
57
|
-
contact: { id: employee.contactId },
|
|
58
|
-
type: contact_1.ContactField.Address,
|
|
59
|
-
label: 'work'
|
|
60
|
-
}));
|
|
61
|
-
return address === null || address === void 0 ? void 0 : address.value;
|
|
61
|
+
await getContactItem(employee.contactId, contact_1.ContactField.Address, 'work', context);
|
|
62
62
|
}
|
|
63
|
-
async email(employee) {
|
|
63
|
+
async email(employee, context) {
|
|
64
64
|
if (!employee.contactId) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
contact: { id: employee.contactId },
|
|
69
|
-
type: contact_1.ContactField.Email,
|
|
70
|
-
label: 'work'
|
|
71
|
-
}));
|
|
72
|
-
return email === null || email === void 0 ? void 0 : email.value;
|
|
67
|
+
await getContactItem(employee.contactId, contact_1.ContactField.Email, 'work', context);
|
|
73
68
|
}
|
|
74
69
|
async profile(employee) {
|
|
75
70
|
if (!employee.contactId) {
|
|
@@ -151,22 +146,25 @@ tslib_1.__decorate([
|
|
|
151
146
|
tslib_1.__decorate([
|
|
152
147
|
(0, type_graphql_1.FieldResolver)(type => String),
|
|
153
148
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
149
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
154
150
|
tslib_1.__metadata("design:type", Function),
|
|
155
|
-
tslib_1.__metadata("design:paramtypes", [employee_1.Employee]),
|
|
151
|
+
tslib_1.__metadata("design:paramtypes", [employee_1.Employee, Object]),
|
|
156
152
|
tslib_1.__metadata("design:returntype", Promise)
|
|
157
153
|
], EmployeeQuery.prototype, "phone", null);
|
|
158
154
|
tslib_1.__decorate([
|
|
159
155
|
(0, type_graphql_1.FieldResolver)(type => String),
|
|
160
156
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
157
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
161
158
|
tslib_1.__metadata("design:type", Function),
|
|
162
|
-
tslib_1.__metadata("design:paramtypes", [employee_1.Employee]),
|
|
159
|
+
tslib_1.__metadata("design:paramtypes", [employee_1.Employee, Object]),
|
|
163
160
|
tslib_1.__metadata("design:returntype", Promise)
|
|
164
161
|
], EmployeeQuery.prototype, "address", null);
|
|
165
162
|
tslib_1.__decorate([
|
|
166
163
|
(0, type_graphql_1.FieldResolver)(type => String),
|
|
167
164
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
165
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
168
166
|
tslib_1.__metadata("design:type", Function),
|
|
169
|
-
tslib_1.__metadata("design:paramtypes", [employee_1.Employee]),
|
|
167
|
+
tslib_1.__metadata("design:paramtypes", [employee_1.Employee, Object]),
|
|
170
168
|
tslib_1.__metadata("design:returntype", Promise)
|
|
171
169
|
], EmployeeQuery.prototype, "email", null);
|
|
172
170
|
tslib_1.__decorate([
|
|
@@ -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;A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AAa,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;AAtJU,aAAa;IADzB,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,aAAa,CAuJzB;AAvJY,sCAAa","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\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() 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']\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): Promise<string> {\n if (!employee.contactId) {\n return\n }\n const phone = (await getRepository(ContactItem).findOneBy({\n contact: { id: employee.contactId },\n type: ContactField.Phone,\n label: 'work'\n })) as any\n return phone?.value\n }\n\n @FieldResolver(type => String)\n async address(@Root() employee: Employee): Promise<string> {\n if (!employee.contactId) {\n return\n }\n const address = (await getRepository(ContactItem).findOneBy({\n contact: { id: employee.contactId },\n type: ContactField.Address,\n label: 'work'\n })) as any\n return address?.value\n }\n\n @FieldResolver(type => String)\n async email(@Root() employee: Employee): Promise<string> {\n if (!employee.contactId) {\n return\n }\n const email = (await getRepository(ContactItem).findOneBy({\n contact: { id: employee.contactId },\n type: ContactField.Email,\n label: 'work'\n })) as any\n return email?.value\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,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,KAAK,CAAA;IAChC,MAAM,OAAO,GAAY,MAAM,IAAA,qBAAa,EAAC,iBAAO,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,CAAA;IACtH,MAAM,EAAE,KAAK,EAAE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Q;;+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;AA1IU,aAAa;IADzB,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,aAAa,CA2IzB;AA3IY,sCAAa","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() 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']\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"]}
|
|
@@ -12,6 +12,10 @@ tslib_1.__decorate([
|
|
|
12
12
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
13
13
|
tslib_1.__metadata("design:type", String)
|
|
14
14
|
], ObjectRefForEmployee.prototype, "controlNo", void 0);
|
|
15
|
+
tslib_1.__decorate([
|
|
16
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
17
|
+
tslib_1.__metadata("design:type", String)
|
|
18
|
+
], ObjectRefForEmployee.prototype, "photo", void 0);
|
|
15
19
|
tslib_1.__decorate([
|
|
16
20
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
17
21
|
tslib_1.__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"employee-type.js","sourceRoot":"","sources":["../../../server/service/employee/employee-type.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAAsF;AAEtF,iDAA+D;AAE/D,yCAAm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AC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,0BAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CAC/B;AAElB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC3C,oBAAoB;iDAAA;AAEjC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAChC,iBAAS;iDAAA;AAEtB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC7C,gBAAgB;2CAAA;AAEvB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACX;AAnCJ,aAAa;IADzB,IAAA,wBAAS,GAAE;GACC,aAAa,CAoCzB;AApCY,sCAAa;AAuCnB,IAAM,YAAY,GAAlB,MAAM,YAAY;CAMxB,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,mBAAQ,CAAC,CAAC;;2CACT;AAEjB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;2CACN;AALF,YAAY;IADxB,IAAA,yBAAU,GAAE;GACA,YAAY,CAMxB;AANY,oCAAY","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { Employee, EmployeeType } from './employee'\n\n@InputType()\nexport class ObjectRefForEmployee extends ObjectRef {\n @Field({ nullable: true })\n controlNo?: string\n\n @Field({ nullable: true })\n photo?: string\n\n @Field({ nullable: true })\n email?: string\n}\n\n@InputType()\nexport class ObjectRefForUser extends ObjectRef {\n @Field({ nullable: true })\n email?: string\n}\n\n@InputType()\nexport class NewEmployee {\n @Field()\n controlNo: string\n\n @Field()\n name: string\n\n @Field(type => EmployeeType, { nullable: true })\n type?: EmployeeType\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n extension?: string\n\n @Field({ nullable: true })\n hiredOn?: string\n\n @Field(type => GraphQLUpload, { nullable: true })\n photo?: FileUpload\n\n @Field({ nullable: true })\n note?: string\n\n @Field(type => ObjectRefForEmployee, { nullable: true })\n supervisor?: ObjectRefForEmployee\n\n @Field(type => ObjectRef, { nullable: true })\n department?: ObjectRef\n\n @Field(type => ObjectRefForUser, { nullable: true })\n user?: ObjectRefForUser\n}\n\n@InputType()\nexport class EmployeePatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n controlNo?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field(type => EmployeeType, { nullable: true })\n type?: EmployeeType\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hiredOn?: string\n\n @Field(type => GraphQLUpload, { nullable: true })\n photo?: FileUpload\n\n @Field({ nullable: true })\n note?: string\n\n @Field(type => ObjectRefForEmployee, { nullable: true })\n supervisor?: ObjectRefForEmployee\n\n @Field(type => ObjectRef, { nullable: true })\n department?: ObjectRef\n\n @Field(type => ObjectRefForUser, { nullable: true })\n user?: ObjectRefForUser\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class EmployeeList {\n @Field(type => [Employee])\n items: Employee[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|