@things-factory/organization 8.0.0-beta.8 → 8.0.0
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/bootstrap.ts +23 -0
- package/client/component/approval-line-brief.ts +119 -0
- package/client/component/approval-line-items-editor-popup.ts +91 -0
- package/client/component/approval-line-items-editor.ts +325 -0
- package/client/component/approval-line-selector.ts +235 -0
- package/client/component/approval-line-templates-manager.ts +229 -0
- package/client/component/approval-line-view.ts +122 -0
- package/client/component/assignees-editor-popup.ts +79 -0
- package/client/component/assignees-editor.ts +217 -0
- package/client/component/assignees-view.ts +55 -0
- package/client/component/department-selector.ts +151 -0
- package/client/component/department-view.ts +107 -0
- package/client/component/index.ts +16 -0
- package/client/component/recipients-editor-popup.ts +79 -0
- package/client/component/recipients-editor.ts +212 -0
- package/client/component/recipients-view.ts +55 -0
- package/client/grist-editor/grist-editor-approval-line.ts +70 -0
- package/client/grist-editor/grist-editor-assignees.ts +69 -0
- package/client/grist-editor/grist-editor-department-object.ts +78 -0
- package/client/grist-editor/grist-editor-recipients.ts +69 -0
- package/client/grist-editor/grist-renderer-approval-line.ts +13 -0
- package/client/grist-editor/grist-renderer-assignees.ts +13 -0
- package/client/grist-editor/grist-renderer-department-object.ts +13 -0
- package/client/grist-editor/grist-renderer-recipients.ts +13 -0
- package/client/index.ts +2 -0
- package/client/pages/approval-line/common-approval-line-templates-page.ts +382 -0
- package/client/pages/approval-line/my-approval-line-templates-page.ts +385 -0
- package/client/pages/department/department-importer.ts +87 -0
- package/client/pages/department/department-list-page.ts +450 -0
- package/client/pages/department/department-tree-page.ts +379 -0
- package/client/pages/employee/employee-importer.ts +87 -0
- package/client/pages/employee/employee-list-page.ts +772 -0
- package/client/pages/employee/employees-by-department.ts +519 -0
- package/client/route.ts +27 -0
- package/client/tsconfig.json +13 -0
- package/client/types/approval-line.ts +52 -0
- package/client/types/contact.ts +51 -0
- package/client/types/department.ts +29 -0
- package/client/types/employee.ts +50 -0
- package/client/types/index.ts +5 -0
- package/client/types/org-member.ts +27 -0
- package/dist-client/bootstrap.js +1 -8
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/pages/employee/employee-list-page.js +3 -3
- package/dist-client/pages/employee/employee-list-page.js.map +1 -1
- package/dist-client/pages/employee/employees-by-department.js +2 -2
- package/dist-client/pages/employee/employees-by-department.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/employee/employee-history.d.ts +2 -6
- package/dist-server/service/employee/employee-history.js +3 -23
- package/dist-server/service/employee/employee-history.js.map +1 -1
- package/dist-server/service/employee/employee-query.js +1 -1
- package/dist-server/service/employee/employee-query.js.map +1 -1
- package/dist-server/service/employee/employee-type.d.ts +5 -13
- package/dist-server/service/employee/employee-type.js +7 -39
- package/dist-server/service/employee/employee-type.js.map +1 -1
- package/dist-server/service/employee/employee.d.ts +2 -6
- package/dist-server/service/employee/employee.js +3 -23
- package/dist-server/service/employee/employee.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
- package/server/controllers/register-employee-as-system-user.ts +136 -0
- package/server/index.ts +3 -0
- package/server/migrations/1723861013111-seed-organization-codes.ts +127 -0
- package/server/migrations/index.ts +9 -0
- package/server/routes.ts +26 -0
- package/server/service/approval-line/approval-line-item.ts +42 -0
- package/server/service/approval-line/approval-line-mutation.ts +394 -0
- package/server/service/approval-line/approval-line-query.ts +208 -0
- package/server/service/approval-line/approval-line-type.ts +63 -0
- package/server/service/approval-line/approval-line.ts +123 -0
- package/server/service/approval-line/index.ts +7 -0
- package/server/service/department/department-history.ts +141 -0
- package/server/service/department/department-mutation.ts +231 -0
- package/server/service/department/department-query.ts +131 -0
- package/server/service/department/department-type.ts +74 -0
- package/server/service/department/department.ts +116 -0
- package/server/service/department/event-subscriber.ts +17 -0
- package/server/service/department/index.ts +9 -0
- package/server/service/employee/employee-history.ts +173 -0
- package/server/service/employee/employee-mutation.ts +386 -0
- package/server/service/employee/employee-query.ts +172 -0
- package/server/service/employee/employee-type.ts +176 -0
- package/server/service/employee/employee.ts +177 -0
- package/server/service/employee/event-subscriber.ts +17 -0
- package/server/service/employee/index.ts +9 -0
- package/server/service/index.ts +39 -0
- package/server/tsconfig.json +10 -0
- package/dist-client/filters-form/filter-department-object.d.ts +0 -3
- package/dist-client/filters-form/filter-department-object.js +0 -8
- package/dist-client/filters-form/filter-department-object.js.map +0 -1
- package/dist-client/filters-form/ox-filter-department-object.d.ts +0 -15
- package/dist-client/filters-form/ox-filter-department-object.js +0 -130
- package/dist-client/filters-form/ox-filter-department-object.js.map +0 -1
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
+
import { GraphQLEmailAddress } from 'graphql-scalars'
|
|
3
|
+
import { Attachment } from '@things-factory/attachment-base'
|
|
4
|
+
import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
5
|
+
import { User } from '@things-factory/auth-base'
|
|
6
|
+
import { Contact, ContactItem, ContactField, Profile } from '@things-factory/contact'
|
|
7
|
+
import { Employee } from './employee'
|
|
8
|
+
import { EmployeeList } from './employee-type'
|
|
9
|
+
import { Department } from '../department/department'
|
|
10
|
+
|
|
11
|
+
async function getContactItem(contactId: string, type: string, label: string, context: ResolverContext) {
|
|
12
|
+
const { domain } = context.state
|
|
13
|
+
const contact: Contact = await getRepository(Contact).findOne({ where: { domain: { id: domain.id }, id: contactId } })
|
|
14
|
+
const { items } = contact
|
|
15
|
+
|
|
16
|
+
if (!items || !(items instanceof Array)) {
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return items?.find(item => item.type === type && item.label === label)?.value
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@Resolver(Employee)
|
|
24
|
+
export class EmployeeQuery {
|
|
25
|
+
@Directive('@privilege(category: "employee", privilege: "query", domainOwnerGranted: true)')
|
|
26
|
+
@Query(returns => Employee!, {
|
|
27
|
+
nullable: true,
|
|
28
|
+
description:
|
|
29
|
+
'Fetches a specific employee by their unique ID. Returns the employee object if found, or null if not found.'
|
|
30
|
+
})
|
|
31
|
+
async employee(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Employee> {
|
|
32
|
+
const { domain } = context.state
|
|
33
|
+
|
|
34
|
+
return await getRepository(Employee).findOne({
|
|
35
|
+
where: { domain: { id: domain.id }, id }
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@Directive('@privilege(category: "employee", privilege: "query", domainOwnerGranted: true)')
|
|
40
|
+
@Query(returns => EmployeeList, {
|
|
41
|
+
description:
|
|
42
|
+
'Fetches a list of employees based on provided query parameters. Supports searching by name, control number, and alias.'
|
|
43
|
+
})
|
|
44
|
+
async employees(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<EmployeeList> {
|
|
45
|
+
const { domain } = context.state
|
|
46
|
+
|
|
47
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
|
48
|
+
domain,
|
|
49
|
+
params,
|
|
50
|
+
repository: await getRepository(Employee),
|
|
51
|
+
searchables: ['name', 'controlNo', 'alias']
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const [items, total] = await queryBuilder.getManyAndCount()
|
|
55
|
+
|
|
56
|
+
return { items, total }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@FieldResolver(type => String, { nullable: true })
|
|
60
|
+
async photo(@Root() employee: Employee): Promise<string | undefined> {
|
|
61
|
+
const attachment: Attachment = await getRepository(Attachment).findOne({
|
|
62
|
+
where: {
|
|
63
|
+
domain: { id: employee.domainId },
|
|
64
|
+
refType: Employee.name,
|
|
65
|
+
refBy: employee.id
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
return attachment?.fullpath
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@FieldResolver(type => String, { nullable: true })
|
|
73
|
+
async phone(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string> {
|
|
74
|
+
if (!employee.contactId) {
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return await getContactItem(employee.contactId, ContactField.Phone, 'work', context)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@FieldResolver(type => String, { nullable: true })
|
|
82
|
+
async address(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string | undefined> {
|
|
83
|
+
if (!employee.contactId) {
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return await getContactItem(employee.contactId, ContactField.Address, 'work', context)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@FieldResolver(type => GraphQLEmailAddress, { nullable: true })
|
|
91
|
+
async email(@Root() employee: Employee, @Ctx() context: ResolverContext): Promise<string | undefined> {
|
|
92
|
+
if (!employee.contactId) {
|
|
93
|
+
return
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return await getContactItem(employee.contactId, ContactField.Email, 'work', context)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@FieldResolver(type => Profile)
|
|
100
|
+
async profile(@Root() employee: Employee): Promise<Profile> {
|
|
101
|
+
if (!employee.contactId) {
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let contact: Contact = employee.contact
|
|
106
|
+
if (!contact) {
|
|
107
|
+
contact = await getRepository(Contact).findOneBy({
|
|
108
|
+
id: employee.contactId
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
if (!contact) {
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const { id: refBy } = contact
|
|
117
|
+
const { left, top, zoom } = contact.profile || {}
|
|
118
|
+
|
|
119
|
+
const attachment: Attachment = await getRepository(Attachment).findOne({
|
|
120
|
+
where: {
|
|
121
|
+
domain: { id: contact.domainId },
|
|
122
|
+
refType: Contact.name,
|
|
123
|
+
refBy
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
return { left, top, zoom, picture: attachment?.fullpath }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@FieldResolver(type => Department)
|
|
131
|
+
async department(@Root() employee: Employee): Promise<Department> {
|
|
132
|
+
if (employee.departmentId) {
|
|
133
|
+
return await getRepository(Department).findOneBy({ id: employee.departmentId })
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@FieldResolver(type => User)
|
|
138
|
+
async user(@Root() employee: Employee): Promise<User> {
|
|
139
|
+
if (employee.userId) {
|
|
140
|
+
return await getRepository(User).findOneBy({ id: employee.userId })
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@FieldResolver(type => Employee)
|
|
145
|
+
async supervisor(@Root() employee: Employee): Promise<Employee> {
|
|
146
|
+
if (employee.supervisorId) {
|
|
147
|
+
return await getRepository(Employee).findOneBy({ id: employee.supervisorId })
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@FieldResolver(type => Contact)
|
|
152
|
+
async contact(@Root() employee: Employee): Promise<Contact> {
|
|
153
|
+
if (employee.contactId) {
|
|
154
|
+
return await getRepository(Contact).findOneBy({ id: employee.contactId })
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@FieldResolver(type => Domain)
|
|
159
|
+
async domain(@Root() employee: Employee): Promise<Domain> {
|
|
160
|
+
return await getRepository(Domain).findOneBy({ id: employee.domainId })
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@FieldResolver(type => User)
|
|
164
|
+
async updater(@Root() employee: Employee): Promise<User> {
|
|
165
|
+
return await getRepository(User).findOneBy({ id: employee.updaterId })
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@FieldResolver(type => User)
|
|
169
|
+
async creator(@Root() employee: Employee): Promise<User> {
|
|
170
|
+
return await getRepository(User).findOneBy({ id: employee.creatorId })
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'
|
|
2
|
+
import GraphQLUpload from 'graphql-upload/GraphQLUpload.js'
|
|
3
|
+
import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
|
|
4
|
+
import { GraphQLEmailAddress } from 'graphql-scalars'
|
|
5
|
+
|
|
6
|
+
import { ObjectRef, ScalarObject } from '@things-factory/shell'
|
|
7
|
+
|
|
8
|
+
import { Employee, EmployeeType } from './employee'
|
|
9
|
+
|
|
10
|
+
@InputType()
|
|
11
|
+
export class ObjectRefForEmployee extends ObjectRef {
|
|
12
|
+
@Field({ nullable: true })
|
|
13
|
+
controlNo?: string
|
|
14
|
+
|
|
15
|
+
@Field(type => EmployeeType, { nullable: true })
|
|
16
|
+
type?: EmployeeType
|
|
17
|
+
|
|
18
|
+
@Field({ nullable: true })
|
|
19
|
+
alias?: string
|
|
20
|
+
|
|
21
|
+
@Field({ nullable: true })
|
|
22
|
+
photo?: string
|
|
23
|
+
|
|
24
|
+
@Field(type => GraphQLEmailAddress, { nullable: true })
|
|
25
|
+
email?: string
|
|
26
|
+
|
|
27
|
+
@Field({ nullable: true })
|
|
28
|
+
jobPosition?: string
|
|
29
|
+
|
|
30
|
+
@Field({ nullable: true })
|
|
31
|
+
jobResponsibility?: string
|
|
32
|
+
|
|
33
|
+
@Field({ nullable: true })
|
|
34
|
+
hiredOn?: string
|
|
35
|
+
|
|
36
|
+
@Field({ nullable: true })
|
|
37
|
+
active?: boolean
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@InputType()
|
|
41
|
+
export class ObjectRefForContact extends ObjectRef {
|
|
42
|
+
@Field(type => GraphQLEmailAddress, { nullable: true })
|
|
43
|
+
email?: string
|
|
44
|
+
|
|
45
|
+
@Field({ nullable: true })
|
|
46
|
+
phone?: string
|
|
47
|
+
|
|
48
|
+
@Field({ nullable: true })
|
|
49
|
+
address?: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@InputType()
|
|
53
|
+
export class ObjectRefForDepartment extends ObjectRef {
|
|
54
|
+
@Field({ nullable: true })
|
|
55
|
+
controlNo?: string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@InputType()
|
|
59
|
+
export class ObjectRefForUser extends ObjectRef {
|
|
60
|
+
@Field(type => GraphQLEmailAddress, { nullable: true })
|
|
61
|
+
email?: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@InputType()
|
|
65
|
+
export class NewEmployee {
|
|
66
|
+
@Field()
|
|
67
|
+
controlNo: string
|
|
68
|
+
|
|
69
|
+
@Field()
|
|
70
|
+
name: string
|
|
71
|
+
|
|
72
|
+
@Field({ nullable: true })
|
|
73
|
+
alias?: string
|
|
74
|
+
|
|
75
|
+
@Field({ nullable: true })
|
|
76
|
+
jobResponsibility?: string
|
|
77
|
+
|
|
78
|
+
@Field({ nullable: true })
|
|
79
|
+
jobPosition?: string
|
|
80
|
+
|
|
81
|
+
@Field(type => EmployeeType, { nullable: true })
|
|
82
|
+
type?: EmployeeType
|
|
83
|
+
|
|
84
|
+
@Field({ nullable: true })
|
|
85
|
+
active?: boolean
|
|
86
|
+
|
|
87
|
+
@Field({ nullable: true })
|
|
88
|
+
extension?: string
|
|
89
|
+
|
|
90
|
+
@Field({ nullable: true })
|
|
91
|
+
hiredOn?: string
|
|
92
|
+
|
|
93
|
+
@Field({ nullable: true })
|
|
94
|
+
retiredAt?: string
|
|
95
|
+
|
|
96
|
+
@Field(type => GraphQLUpload, { nullable: true })
|
|
97
|
+
photo?: FileUpload
|
|
98
|
+
|
|
99
|
+
@Field({ nullable: true })
|
|
100
|
+
note?: string
|
|
101
|
+
|
|
102
|
+
@Field(type => ObjectRefForEmployee, { nullable: true })
|
|
103
|
+
supervisor?: ObjectRefForEmployee
|
|
104
|
+
|
|
105
|
+
@Field(type => ObjectRefForDepartment, { nullable: true })
|
|
106
|
+
department?: ObjectRefForDepartment
|
|
107
|
+
|
|
108
|
+
@Field(type => ObjectRefForContact, { nullable: true })
|
|
109
|
+
contact?: ObjectRefForContact
|
|
110
|
+
|
|
111
|
+
@Field(type => ObjectRefForUser, { nullable: true })
|
|
112
|
+
user?: ObjectRefForUser
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@InputType()
|
|
116
|
+
export class EmployeePatch {
|
|
117
|
+
@Field(type => ID, { nullable: true })
|
|
118
|
+
id?: string
|
|
119
|
+
|
|
120
|
+
@Field({ nullable: true })
|
|
121
|
+
controlNo?: string
|
|
122
|
+
|
|
123
|
+
@Field({ nullable: true })
|
|
124
|
+
name?: string
|
|
125
|
+
|
|
126
|
+
@Field({ nullable: true })
|
|
127
|
+
alias?: string
|
|
128
|
+
|
|
129
|
+
@Field({ nullable: true })
|
|
130
|
+
jobResponsibility?: string
|
|
131
|
+
|
|
132
|
+
@Field({ nullable: true })
|
|
133
|
+
jobPosition?: string
|
|
134
|
+
|
|
135
|
+
@Field(type => EmployeeType, { nullable: true })
|
|
136
|
+
type?: EmployeeType
|
|
137
|
+
|
|
138
|
+
@Field({ nullable: true })
|
|
139
|
+
active?: boolean
|
|
140
|
+
|
|
141
|
+
@Field({ nullable: true })
|
|
142
|
+
hiredOn?: string
|
|
143
|
+
|
|
144
|
+
@Field({ nullable: true })
|
|
145
|
+
retiredAt?: string
|
|
146
|
+
|
|
147
|
+
@Field(type => GraphQLUpload, { nullable: true })
|
|
148
|
+
photo?: FileUpload
|
|
149
|
+
|
|
150
|
+
@Field({ nullable: true })
|
|
151
|
+
note?: string
|
|
152
|
+
|
|
153
|
+
@Field(type => ObjectRefForEmployee, { nullable: true })
|
|
154
|
+
supervisor?: ObjectRefForEmployee
|
|
155
|
+
|
|
156
|
+
@Field(type => ObjectRefForDepartment, { nullable: true })
|
|
157
|
+
department?: ObjectRefForDepartment
|
|
158
|
+
|
|
159
|
+
@Field(type => ObjectRefForContact, { nullable: true })
|
|
160
|
+
contact?: ObjectRefForContact
|
|
161
|
+
|
|
162
|
+
@Field(type => ObjectRefForUser, { nullable: true })
|
|
163
|
+
user?: ObjectRefForUser
|
|
164
|
+
|
|
165
|
+
@Field({ nullable: true })
|
|
166
|
+
cuFlag?: string
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@ObjectType()
|
|
170
|
+
export class EmployeeList {
|
|
171
|
+
@Field(type => [Employee])
|
|
172
|
+
items: Employee[]
|
|
173
|
+
|
|
174
|
+
@Field(type => Int)
|
|
175
|
+
total: number
|
|
176
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CreateDateColumn,
|
|
3
|
+
UpdateDateColumn,
|
|
4
|
+
DeleteDateColumn,
|
|
5
|
+
Entity,
|
|
6
|
+
Index,
|
|
7
|
+
Column,
|
|
8
|
+
OneToMany,
|
|
9
|
+
RelationId,
|
|
10
|
+
ManyToOne,
|
|
11
|
+
PrimaryGeneratedColumn,
|
|
12
|
+
VersionColumn
|
|
13
|
+
} from 'typeorm'
|
|
14
|
+
import { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'
|
|
15
|
+
import { GraphQLEmailAddress } from 'graphql-scalars'
|
|
16
|
+
|
|
17
|
+
import { Domain } from '@things-factory/shell'
|
|
18
|
+
import { User } from '@things-factory/auth-base'
|
|
19
|
+
import { Contact, Profile } from '@things-factory/contact'
|
|
20
|
+
|
|
21
|
+
import { Department } from '../department/department'
|
|
22
|
+
import { ApprovalLine } from '../approval-line/approval-line'
|
|
23
|
+
|
|
24
|
+
export enum EmployeeType {
|
|
25
|
+
FULLTIME = 'FULLTIME',
|
|
26
|
+
PARTTIME = 'PARTTIME',
|
|
27
|
+
TEMPORARY = 'TEMPORARY'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
registerEnumType(EmployeeType, {
|
|
31
|
+
name: 'EmployeeType',
|
|
32
|
+
description: 'type enumeration of a employee'
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
@Entity()
|
|
36
|
+
@Index('ix_employee_0', (employee: Employee) => [employee.domain, employee.controlNo, employee.deletedAt], {
|
|
37
|
+
unique: true
|
|
38
|
+
})
|
|
39
|
+
@ObjectType({ description: 'Entity for Employee' })
|
|
40
|
+
export class Employee {
|
|
41
|
+
@PrimaryGeneratedColumn('uuid')
|
|
42
|
+
@Field(type => ID)
|
|
43
|
+
readonly id: string
|
|
44
|
+
|
|
45
|
+
@VersionColumn()
|
|
46
|
+
@Field({ nullable: true })
|
|
47
|
+
version?: number = 1
|
|
48
|
+
|
|
49
|
+
@ManyToOne(type => Domain)
|
|
50
|
+
@Field(type => Domain)
|
|
51
|
+
domain?: Domain
|
|
52
|
+
|
|
53
|
+
@RelationId((employee: Employee) => employee.domain)
|
|
54
|
+
domainId?: string
|
|
55
|
+
|
|
56
|
+
@Column()
|
|
57
|
+
@Field({ nullable: false })
|
|
58
|
+
controlNo: string
|
|
59
|
+
|
|
60
|
+
@Column()
|
|
61
|
+
@Field({ nullable: true })
|
|
62
|
+
name?: string
|
|
63
|
+
|
|
64
|
+
@Column({ nullable: true })
|
|
65
|
+
@Field({ nullable: true })
|
|
66
|
+
alias?: string
|
|
67
|
+
|
|
68
|
+
@Column({ nullable: true })
|
|
69
|
+
@Field({ nullable: true })
|
|
70
|
+
jobResponsibility?: string
|
|
71
|
+
|
|
72
|
+
@Column({ nullable: true })
|
|
73
|
+
@Field({ nullable: true })
|
|
74
|
+
jobPosition?: string
|
|
75
|
+
|
|
76
|
+
@ManyToOne(type => Employee, supervisor => supervisor.supervises, { nullable: true })
|
|
77
|
+
@Field(type => Employee, { nullable: true })
|
|
78
|
+
supervisor?: Employee
|
|
79
|
+
|
|
80
|
+
@RelationId((employee: Employee) => employee.supervisor)
|
|
81
|
+
supervisorId?: string
|
|
82
|
+
|
|
83
|
+
@OneToMany(type => Employee, employee => employee.supervisor)
|
|
84
|
+
@Field(type => [Employee])
|
|
85
|
+
supervises?: Employee[]
|
|
86
|
+
|
|
87
|
+
@ManyToOne(type => Department, department => department.members, { nullable: true })
|
|
88
|
+
@Field(type => Department, { nullable: true })
|
|
89
|
+
department?: Department
|
|
90
|
+
|
|
91
|
+
@RelationId((employee: Employee) => employee.department)
|
|
92
|
+
departmentId?: string
|
|
93
|
+
|
|
94
|
+
@OneToMany(type => Department, department => department.manager)
|
|
95
|
+
@Field(type => [Department])
|
|
96
|
+
manages?: Department[]
|
|
97
|
+
|
|
98
|
+
@OneToMany(type => ApprovalLine, employee => employee.ownerEmployee)
|
|
99
|
+
@Field(type => [ApprovalLine])
|
|
100
|
+
approvalLines?: ApprovalLine[]
|
|
101
|
+
|
|
102
|
+
@Column({ nullable: true })
|
|
103
|
+
@Field({ nullable: true })
|
|
104
|
+
active?: boolean
|
|
105
|
+
|
|
106
|
+
@Column({ nullable: true })
|
|
107
|
+
@Field({ nullable: true })
|
|
108
|
+
type?: EmployeeType
|
|
109
|
+
|
|
110
|
+
@Column({ nullable: true })
|
|
111
|
+
@Field({ nullable: true })
|
|
112
|
+
extension?: string
|
|
113
|
+
|
|
114
|
+
@Field(type => String, { nullable: true })
|
|
115
|
+
photo?: string
|
|
116
|
+
|
|
117
|
+
@ManyToOne(type => User, { nullable: true })
|
|
118
|
+
@Field({ nullable: true })
|
|
119
|
+
user?: User
|
|
120
|
+
|
|
121
|
+
@RelationId((employee: Employee) => employee.user)
|
|
122
|
+
userId?: string
|
|
123
|
+
|
|
124
|
+
@ManyToOne(type => Contact, { nullable: true })
|
|
125
|
+
@Field({ nullable: true })
|
|
126
|
+
contact?: Contact
|
|
127
|
+
|
|
128
|
+
@RelationId((employee: Employee) => employee.contact)
|
|
129
|
+
contactId?: string
|
|
130
|
+
|
|
131
|
+
@Field(type => GraphQLEmailAddress, { nullable: true })
|
|
132
|
+
email?: string
|
|
133
|
+
|
|
134
|
+
@Field({ nullable: true })
|
|
135
|
+
phone?: string
|
|
136
|
+
|
|
137
|
+
@Field(type => Profile, { nullable: true })
|
|
138
|
+
profile?: Profile
|
|
139
|
+
|
|
140
|
+
@Column({ nullable: true })
|
|
141
|
+
@Field({ nullable: true })
|
|
142
|
+
note?: string
|
|
143
|
+
|
|
144
|
+
@Column({ nullable: true })
|
|
145
|
+
@Field({ nullable: true })
|
|
146
|
+
hiredOn?: string
|
|
147
|
+
|
|
148
|
+
@Column({ nullable: true })
|
|
149
|
+
@Field({ nullable: true })
|
|
150
|
+
retiredAt?: string
|
|
151
|
+
|
|
152
|
+
@CreateDateColumn()
|
|
153
|
+
@Field({ nullable: true })
|
|
154
|
+
createdAt?: Date
|
|
155
|
+
|
|
156
|
+
@UpdateDateColumn()
|
|
157
|
+
@Field({ nullable: true })
|
|
158
|
+
updatedAt?: Date
|
|
159
|
+
|
|
160
|
+
@DeleteDateColumn()
|
|
161
|
+
@Field({ nullable: true })
|
|
162
|
+
deletedAt?: Date
|
|
163
|
+
|
|
164
|
+
@ManyToOne(type => User, { nullable: true })
|
|
165
|
+
@Field(type => User, { nullable: true })
|
|
166
|
+
creator?: User
|
|
167
|
+
|
|
168
|
+
@RelationId((employee: Employee) => employee.creator)
|
|
169
|
+
creatorId?: string
|
|
170
|
+
|
|
171
|
+
@ManyToOne(type => User, { nullable: true })
|
|
172
|
+
@Field(type => User, { nullable: true })
|
|
173
|
+
updater?: User
|
|
174
|
+
|
|
175
|
+
@RelationId((employee: Employee) => employee.updater)
|
|
176
|
+
updaterId?: string
|
|
177
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EventSubscriber } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
import { HistoryEntitySubscriber } from '@operato/typeorm-history'
|
|
4
|
+
|
|
5
|
+
import { Employee } from './employee'
|
|
6
|
+
import { EmployeeHistory } from './employee-history'
|
|
7
|
+
|
|
8
|
+
@EventSubscriber()
|
|
9
|
+
export class EmployeeHistoryEntitySubscriber extends HistoryEntitySubscriber<Employee, EmployeeHistory> {
|
|
10
|
+
public get entity() {
|
|
11
|
+
return Employee
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public get historyEntity() {
|
|
15
|
+
return EmployeeHistory
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Employee } from './employee'
|
|
2
|
+
import { EmployeeHistory } from './employee-history'
|
|
3
|
+
import { EmployeeQuery } from './employee-query'
|
|
4
|
+
import { EmployeeMutation } from './employee-mutation'
|
|
5
|
+
import { EmployeeHistoryEntitySubscriber } from './event-subscriber'
|
|
6
|
+
|
|
7
|
+
export const entities = [Employee, EmployeeHistory]
|
|
8
|
+
export const resolvers = [EmployeeQuery, EmployeeMutation]
|
|
9
|
+
export const subscribers = [EmployeeHistoryEntitySubscriber]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* EXPORT ENTITY TYPES */
|
|
2
|
+
export * from './approval-line/approval-line'
|
|
3
|
+
export * from './department/department'
|
|
4
|
+
export * from './employee/employee'
|
|
5
|
+
|
|
6
|
+
/* IMPORT ENTITIES AND RESOLVERS */
|
|
7
|
+
import { entities as ApprovalLineEntities, resolvers as ApprovalLineResolvers } from './approval-line'
|
|
8
|
+
import {
|
|
9
|
+
entities as DepartmentEntities,
|
|
10
|
+
resolvers as DepartmentResolvers,
|
|
11
|
+
subscribers as DepartmentSubscribers
|
|
12
|
+
} from './department'
|
|
13
|
+
import {
|
|
14
|
+
entities as EmployeeEntities,
|
|
15
|
+
resolvers as EmployeeResolvers,
|
|
16
|
+
subscribers as EmployeeSubscribers
|
|
17
|
+
} from './employee'
|
|
18
|
+
|
|
19
|
+
export const entities = [
|
|
20
|
+
/* ENTITIES */
|
|
21
|
+
...ApprovalLineEntities,
|
|
22
|
+
...DepartmentEntities,
|
|
23
|
+
...EmployeeEntities
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
export const subscribers = [
|
|
27
|
+
/* SUBSCRIBERS */
|
|
28
|
+
...DepartmentSubscribers,
|
|
29
|
+
...EmployeeSubscribers
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
export const schema = {
|
|
33
|
+
resolverClasses: [
|
|
34
|
+
/* RESOLVER CLASSES */
|
|
35
|
+
...ApprovalLineResolvers,
|
|
36
|
+
...DepartmentResolvers,
|
|
37
|
+
...EmployeeResolvers
|
|
38
|
+
]
|
|
39
|
+
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import './ox-filter-department-object.js';
|
|
2
|
-
import { html } from 'lit-html';
|
|
3
|
-
export const FilterDepartmentObject = (column, value, owner) => {
|
|
4
|
-
return html `
|
|
5
|
-
<ox-filter-department-object name=${column === null || column === void 0 ? void 0 : column.name} .column=${column} .value=${value}></ox-filter-department-object>
|
|
6
|
-
`;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=filter-department-object.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filter-department-object.js","sourceRoot":"","sources":["../../client/filters-form/filter-department-object.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAI/B,MAAM,CAAC,MAAM,sBAAsB,GAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IACnF,OAAO,IAAI,CAAA;wCAC2B,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,YAAY,MAAM,WAAW,KAAK;GACnF,CAAA;AACH,CAAC,CAAA","sourcesContent":["import './ox-filter-department-object.js'\n\nimport { html } from 'lit-html'\n\nimport { FilterSelectRenderer } from '@operato/data-grist'\n\nexport const FilterDepartmentObject: FilterSelectRenderer = (column, value, owner) => {\n return html`\n <ox-filter-department-object name=${column?.name} .column=${column} .value=${value}></ox-filter-department-object>\n `\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import '../component/department-selector.js';
|
|
2
|
-
import { TemplateResult } from 'lit';
|
|
3
|
-
import { OxFormField } from '@operato/input';
|
|
4
|
-
export declare class OxFilterDepartmentObject extends OxFormField {
|
|
5
|
-
static styles: import("lit").CSSResult[];
|
|
6
|
-
column: any;
|
|
7
|
-
value?: string;
|
|
8
|
-
department?: any;
|
|
9
|
-
private popup?;
|
|
10
|
-
private template?;
|
|
11
|
-
render(): TemplateResult<1>;
|
|
12
|
-
_onclick(e: Event): void;
|
|
13
|
-
_onkeydown(e: KeyboardEvent): void;
|
|
14
|
-
openSelector(): void;
|
|
15
|
-
}
|