@things-factory/work-shift 8.0.5 → 9.0.0-beta.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/work-shift",
3
- "version": "8.0.5",
3
+ "version": "9.0.0-beta.12",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -27,10 +27,10 @@
27
27
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create ./server/migrations/migration"
28
28
  },
29
29
  "dependencies": {
30
- "@things-factory/auth-base": "^8.0.5",
31
- "@things-factory/env": "^8.0.2",
32
- "@things-factory/shell": "^8.0.2",
30
+ "@things-factory/auth-base": "^9.0.0-beta.12",
31
+ "@things-factory/env": "^9.0.0-beta.5",
32
+ "@things-factory/shell": "^9.0.0-beta.12",
33
33
  "moment-timezone": "^0.5.40"
34
34
  },
35
- "gitHead": "9ab6fca18eeb58b9d2f3411661508a39d0ab6aee"
35
+ "gitHead": "5e9ade1c2d4b4c96b89396e36c3afa1caaf18ef0"
36
36
  }
@@ -1 +0,0 @@
1
- export default function bootstrap() {}
package/client/index.ts DELETED
File without changes
@@ -1,108 +0,0 @@
1
- import '@operato/input/ox-input-work-shift.js'
2
- import '@operato/context/ox-context-page-toolbar.js'
3
-
4
- import { css, html } from 'lit'
5
- import { customElement, query, state } from 'lit/decorators.js'
6
- import gql from 'graphql-tag'
7
-
8
- import { OxFormField } from '@operato/input'
9
- import { PageView, store } from '@operato/shell'
10
- import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'
11
- import { client } from '@operato/graphql'
12
- import { connect } from 'pwa-helpers/connect-mixin.js'
13
- import { i18next } from '@operato/i18n'
14
-
15
- @customElement('work-shift')
16
- class WorkShift extends connect(store)(PageView) {
17
- static styles = [
18
- ScrollbarStyles,
19
- CommonHeaderStyles,
20
- css`
21
- :host {
22
- background-color: var(--md-sys-color-background);
23
- padding: var(--spacing-large);
24
- overflow: auto;
25
- }
26
-
27
- ox-input-work-shift {
28
- overflow-y: auto;
29
- flex: 1;
30
- }
31
- `
32
- ]
33
-
34
- @state() private workShifts: any[] = []
35
-
36
- @query('ox-input-work-shift') private input!: OxFormField
37
-
38
- get context() {
39
- return {
40
- title: i18next.t('title.work-shift'),
41
- actions: [
42
- {
43
- title: i18next.t('button.update'),
44
- action: this.updateWorkShift.bind(this),
45
- icon: 'save'
46
- }
47
- ],
48
- help: 'page/work-shift',
49
- toolbar: false
50
- }
51
- }
52
-
53
- render() {
54
- return html`
55
- <div class="header">
56
- <div class="title">${i18next.t('title.work-shift')}</div>
57
-
58
- <ox-context-page-toolbar class="actions" .context=${this.context}> </ox-context-page-toolbar>
59
- </div>
60
-
61
- <ox-input-work-shift .value=${this.workShifts}></ox-input-work-shift>
62
- `
63
- }
64
-
65
- async pageUpdated(changes, after, before) {
66
- /* refresh always page revisited */
67
- if (this.active) {
68
- const response = await client.query({
69
- query: gql`
70
- query {
71
- workShifts(sortings: [{ name: "fromDate" }, { name: "fromTime" }]) {
72
- items {
73
- name
74
- fromDate
75
- fromTime
76
- toDate
77
- toTime
78
- }
79
- }
80
- }
81
- `
82
- })
83
-
84
- this.workShifts = response.data.workShifts.items
85
- }
86
- }
87
-
88
- private async updateWorkShift() {
89
- const response = await client.mutate({
90
- mutation: gql`
91
- mutation ($patches: [WorkShiftPatch!]!) {
92
- updateMultipleWorkShift(patches: $patches) {
93
- name
94
- fromDate
95
- fromTime
96
- toDate
97
- toTime
98
- }
99
- }
100
- `,
101
- variables: {
102
- patches: this.input.value
103
- }
104
- })
105
-
106
- this.workShifts = response.data.updateMultipleWorkShift
107
- }
108
- }
package/client/route.ts DELETED
@@ -1,7 +0,0 @@
1
- export default function route(page) {
2
- switch (page) {
3
- case 'work-shift':
4
- import('./pages/work-shift')
5
- return page
6
- }
7
- }
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "../../tsconfig-base.json",
3
- "compilerOptions": {
4
- "experimentalDecorators": true,
5
- "skipLibCheck": true,
6
- "strict": true,
7
- "declaration": true,
8
- "module": "esnext",
9
- "outDir": "../dist-client",
10
- "baseUrl": "./"
11
- },
12
- "include": ["./**/*"]
13
- }
@@ -1,2 +0,0 @@
1
- export * from './work-shift-range'
2
- export * from './work-shift-schedule'
@@ -1,250 +0,0 @@
1
- import moment from 'moment-timezone'
2
-
3
- import { logger } from '@things-factory/env'
4
- import { Domain, getRepository } from '@things-factory/shell'
5
-
6
- import { WorkShift } from '../service/work-shift/work-shift'
7
- import { WorkShiftInfo } from '../service/work-shift/work-shift-type'
8
-
9
- export async function getDateRangeForWorkShift(
10
- domain: Domain,
11
- workDate: string,
12
- workShiftName: string,
13
- options?: { timezone?: string; format?: string }
14
- ): Promise<Date[]> {
15
- const dateOptions = { timezone: domain.timezone || 'UTC', format: 'YYYY-MM-DD', ...options }
16
- const { timezone, format } = dateOptions
17
-
18
- const workShift = await getRepository(WorkShift).findOne({
19
- where: {
20
- domain: { id: domain.id },
21
- name: workShiftName
22
- }
23
- })
24
-
25
- if (!workShift) {
26
- return
27
- }
28
- const theDay = moment.tz(workDate, timezone)
29
- const { name, fromDate, fromTime, toDate, toTime } = workShift
30
-
31
- const convertedFromDate = theDay.clone().add(fromDate, 'day')
32
- const convertedToDate = theDay.clone().add(toDate, 'day')
33
- const from = moment
34
- .tz(`${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
35
- .toDate()
36
- const to = moment.tz(`${convertedToDate.format('YYYY-MM-DD')} ${toTime}`, 'YYYY-MM-DD HH:mm:ss', timezone).toDate()
37
-
38
- return [from, to]
39
- }
40
-
41
- export async function getDateRangeForWorkDate(
42
- domain: Domain,
43
- workDate: string,
44
- options?: { timezone?: string; format?: string }
45
- ) {
46
- const dateOptions = { timezone: domain.timezone || 'UTC', format: 'YYYY-MM-DD', ...options }
47
- const { timezone, format } = dateOptions
48
-
49
- var beginDate
50
- var endDate
51
-
52
- /* 1. get work-shift list for the domain */
53
- const workShifts = await getRepository(WorkShift).find({
54
- where: {
55
- domain: { id: domain.id }
56
- },
57
- order: {
58
- fromDate: 'ASC',
59
- fromTime: 'ASC'
60
- }
61
- })
62
-
63
- /* 2. get date-time for every work-shift */
64
- if (workShifts && workShifts.length > 0) {
65
- const theDay = moment.tz(workDate, timezone)
66
-
67
- for (let j = 0; j < workShifts.length; j++) {
68
- const { name, fromDate, fromTime, toDate, toTime } = workShifts[j]
69
-
70
- const convertedFromDate = theDay.clone().add(fromDate, 'day')
71
- const convertedToDate = theDay.clone().add(toDate, 'day')
72
- const from = moment
73
- .tz(`${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
74
- .toDate()
75
- const to = moment
76
- .tz(`${convertedToDate.format('YYYY-MM-DD')} ${toTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
77
- .toDate()
78
-
79
- if (!beginDate) {
80
- beginDate = from
81
- }
82
-
83
- endDate = to
84
- }
85
- } else {
86
- return
87
- }
88
-
89
- /* 3. in case there are no work-shift, just give date and default shift '' */
90
- return [beginDate, endDate]
91
- }
92
-
93
- export async function getWorkDateAndShift(domain: Domain, dateTime: Date, options?: any): Promise<WorkShiftInfo> {
94
- const dateOptions = { timezone: domain.timezone || 'UTC', format: 'YYYY-MM-DD', ...options }
95
- const { timezone, format } = dateOptions
96
-
97
- const givenDate = moment(dateTime).tz(timezone)
98
- /* 1. get work-shift list for the domain */
99
- const workShifts = await getRepository(WorkShift).find({
100
- where: {
101
- domain: { id: domain.id }
102
- },
103
- order: {
104
- fromDate: 'ASC',
105
- fromTime: 'ASC'
106
- }
107
- })
108
-
109
- /* 2. compare given date-time to every work-shift */
110
- const theDay = givenDate.clone().startOf('day')
111
- const theDayBefore = theDay.clone().subtract(1, 'day')
112
- const theDayAfter = theDay.clone().add(1, 'day')
113
-
114
- if (workShifts && workShifts.length > 0) {
115
- const days = [theDayBefore, theDay, theDayAfter]
116
- let dateBegin, dateEnd
117
-
118
- for (let i = 0; i < days.length; i++) {
119
- const day = days[i]
120
- dateBegin = null
121
-
122
- for (let j = 0; j < workShifts.length; j++) {
123
- const { name, fromDate, fromTime, toDate, toTime } = workShifts[j]
124
-
125
- const convertedFromDate = day.clone().add(fromDate, 'day')
126
- const convertedToDate = day.clone().add(toDate, 'day')
127
-
128
- const from = moment.tz(`${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
129
- const to = moment.tz(`${convertedToDate.format('YYYY-MM-DD')} ${toTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
130
-
131
- dateBegin = dateBegin || from
132
- dateEnd = from.clone().add(1, 'day')
133
-
134
- if (dateTime >= from.toDate() && to.toDate() > dateTime) {
135
- return {
136
- workDate: moment(day).format(format),
137
- workShift: name,
138
- dateRange: [dateBegin.toDate(), dateEnd.toDate()],
139
- shiftRange: [from.toDate(), to.toDate()]
140
- }
141
- }
142
- }
143
- }
144
-
145
- logger.error(new Error('shift not found'))
146
- }
147
-
148
- /* 3. in case there are no work-shift, just give date and default shift '' */
149
- return {
150
- workDate: givenDate.format(format),
151
- workShift: '',
152
- dateRange: [theDay.toDate(), theDayAfter.toDate()]
153
- }
154
- }
155
-
156
- export async function getLatestWorkDateAndShift(domain: Domain, dateTime: Date, options?: any): Promise<WorkShiftInfo> {
157
- const dateOptions = { timezone: domain.timezone || 'UTC', format: 'YYYY-MM-DD', ...options }
158
- const { timezone, format } = dateOptions
159
-
160
- const givenDate = moment(dateTime).tz(timezone)
161
-
162
- /* 1. get work-shift list for the domain */
163
- const workShifts = await getRepository(WorkShift).find({
164
- where: {
165
- domain: { id: domain.id }
166
- },
167
- order: {
168
- fromDate: 'ASC',
169
- fromTime: 'ASC'
170
- }
171
- })
172
-
173
- /* 2. compare given date-time to every work-shift */
174
- const theDay = givenDate.clone().startOf('day')
175
- const theDayBefore = theDay.clone().subtract(1, 'day')
176
- const theDayAfter = theDay.clone().add(1, 'day')
177
-
178
- if (workShifts && workShifts.length > 0) {
179
- const days = [theDayBefore, theDay, theDayAfter]
180
- let dateBegin, dateEnd
181
-
182
- for (let i = 0; i < days.length; i++) {
183
- const day = days[i]
184
- dateBegin = null
185
-
186
- for (let j = 0; j < workShifts.length; j++) {
187
- const { name, fromDate, fromTime, toDate, toTime } = workShifts[j]
188
-
189
- const convertedFromDate = day.clone().add(fromDate, 'day')
190
- const convertedToDate = day.clone().add(toDate, 'day')
191
-
192
- const from = moment.tz(`${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
193
- const to = moment.tz(`${convertedToDate.format('YYYY-MM-DD')} ${toTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
194
-
195
- dateBegin = dateBegin || from
196
- dateEnd = from.clone().add(1, 'day')
197
-
198
- if (dateTime < from.toDate()) {
199
- if (j > 0) {
200
- const { name, fromDate, fromTime, toDate, toTime } = workShifts[j - 1]
201
-
202
- const from = moment.tz(
203
- `${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`,
204
- 'YYYY-MM-DD HH:mm:ss',
205
- timezone
206
- )
207
- const to = moment.tz(`${convertedToDate.format('YYYY-MM-DD')} ${toTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
208
-
209
- return {
210
- workDate: moment(day).format(format),
211
- workShift: name,
212
- dateRange: [dateBegin.toDate(), dateEnd.toDate()],
213
- shiftRange: [from.toDate(), to.toDate()]
214
- }
215
- } else if (i > 0) {
216
- const { name, fromDate, fromTime, toDate, toTime } = workShifts[0]
217
-
218
- const convertedFromDate = days[i - 1].clone().add(fromDate, 'day')
219
- const convertedToDate = days[i - 1].clone().add(toDate, 'day')
220
-
221
- const from = moment.tz(
222
- `${convertedFromDate.format('YYYY-MM-DD')} ${fromTime}`,
223
- 'YYYY-MM-DD HH:mm:ss',
224
- timezone
225
- )
226
- const to = moment.tz(`${convertedToDate.format('YYYY-MM-DD')} ${toTime}`, 'YYYY-MM-DD HH:mm:ss', timezone)
227
-
228
- return {
229
- workDate: moment(day).format(format),
230
- workShift: name,
231
- dateRange: [dateBegin.clone().subtract(1, 'day').toDate(), dateBegin.toDate()],
232
- shiftRange: [from.toDate(), to.toDate()]
233
- }
234
- } else {
235
- return
236
- }
237
- }
238
- }
239
- }
240
-
241
- logger.error(new Error('shift not found'))
242
- }
243
-
244
- /* 3. in case there are no work-shift, just give date and default shift '' */
245
- return {
246
- workDate: givenDate.clone().subtract(1, 'day').format(format),
247
- workShift: '',
248
- dateRange: [theDayBefore.toDate(), theDay.toDate()]
249
- }
250
- }
@@ -1,79 +0,0 @@
1
- import { Domain, getRepository } from '@things-factory/shell'
2
-
3
- import { WorkShift } from '../service/work-shift/work-shift'
4
-
5
- export async function getSummaryScheduleForWorkShift(domain: Domain): Promise<string> {
6
- const workShifts = await getRepository(WorkShift).find({
7
- where: {
8
- domain: { id: domain.id }
9
- }
10
- })
11
-
12
- if (!workShifts || workShifts.length == 0) {
13
- return ''
14
- }
15
-
16
- const hours = workShifts
17
- .map(workShift => workShift.toTime)
18
- .map(getNextHourIn24HourFormat)
19
- .join(',')
20
-
21
- return `10 ${hours} * * * *`
22
- }
23
-
24
- export async function getSummaryScheduleForWorkDate(domain: Domain): Promise<string> {
25
- /* 1. 도메인의 워크시프트를 모두 가져온다. */
26
- const workShifts = await getRepository(WorkShift).find({
27
- where: {
28
- domain: { id: domain.id }
29
- },
30
- order: {
31
- fromDate: 'ASC',
32
- fromTime: 'ASC'
33
- }
34
- })
35
-
36
- /* 2. 워크데이의 마지막 시간을 구한 뒤, 그 30분뒤 시간에 매일 수행하는 crontab을 계산한다. */
37
- if (workShifts && workShifts.length > 0) {
38
- const { toTime } = workShifts[workShifts.length - 1]
39
- return timePlusThirtyMinutesToCron(toTime)
40
- } else {
41
- return
42
- }
43
- }
44
-
45
- function timePlusThirtyMinutesToCron(time: string): string {
46
- const isPM = time.toUpperCase().includes('PM')
47
- const [hours, minutes] = time
48
- .toUpperCase()
49
- .replace(/(AM|PM)/, '')
50
- .split(':')
51
- .map(Number)
52
-
53
- // 기준 날짜와 시간 정보를 사용하여 Date 객체를 생성합니다.
54
- let date = new Date(1970, 0, 1, isPM ? (hours % 12) + 12 : hours % 12, minutes)
55
-
56
- // 30분을 추가합니다.
57
- date.setMinutes(date.getMinutes() + 30)
58
-
59
- // 결과 시간을 얻습니다.
60
- const resultHours = String(date.getHours()).padStart(2, '0')
61
- const resultMinutes = String(date.getMinutes()).padStart(2, '0')
62
-
63
- // 결과 시간을 사용하여 crontab 항목을 반환합니다.
64
- return `${resultMinutes} ${resultHours} * * * *`
65
- }
66
-
67
- function getNextHourIn24HourFormat(time: string): string {
68
- const isPM = time.toUpperCase().includes('PM')
69
- const hours = Number(time.split(':')[0])
70
-
71
- // 기준 날짜와 시간 정보를 사용하여 Date 객체를 생성합니다.
72
- let date = new Date(1970, 0, 1, isPM ? (hours % 12) + 12 : hours % 12, 0)
73
-
74
- // 시간 값을 1 증가시킵니다.
75
- date.setHours(date.getHours() + 1)
76
-
77
- // 결과 시간을 얻습니다.
78
- return String(date.getHours()).padStart(2, '0')
79
- }
package/server/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './controllers'
2
- export * from './service'
@@ -1,18 +0,0 @@
1
- /* EXPORT ENTITY TYPES */
2
- export * from './work-shift/work-shift'
3
-
4
- /* IMPORT ENTITIES AND RESOLVERS */
5
- import { entities as WorkShiftEntities, resolvers as WorkShiftResolvers } from './work-shift'
6
-
7
- export const entities = [
8
- /* ENTITIES */
9
- ...WorkShiftEntities,
10
- ]
11
-
12
-
13
- export const schema = {
14
- resolverClasses: [
15
- /* RESOLVER CLASSES */
16
- ...WorkShiftResolvers,
17
- ]
18
- }
@@ -1,7 +0,0 @@
1
- import { DomainWorkShiftQuery, WorkShiftQuery } from './work-shift-query'
2
-
3
- import { WorkShift } from './work-shift'
4
- import { WorkShiftMutation } from './work-shift-mutation'
5
-
6
- export const entities = [WorkShift]
7
- export const resolvers = [DomainWorkShiftQuery, WorkShiftQuery, WorkShiftMutation]
@@ -1,55 +0,0 @@
1
- import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
- import { In } from 'typeorm'
3
-
4
- import { WorkShift } from './work-shift'
5
- import { WorkShiftPatch } from './work-shift-type'
6
-
7
- @Resolver(WorkShift)
8
- export class WorkShiftMutation {
9
- @Directive('@privilege(category: "work-shift", privilege: "mutation", domainOwnerGranted: true)')
10
- @Directive('@transaction')
11
- @Mutation(returns => [WorkShift], { description: "To modify multiple WorkShifts' information" })
12
- async updateMultipleWorkShift(
13
- @Arg('patches', type => [WorkShiftPatch]) patches: WorkShiftPatch[],
14
- @Ctx() context: ResolverContext
15
- ): Promise<WorkShift[]> {
16
- const { domain, user, tx } = context.state
17
-
18
- let results = []
19
- const workShiftRepo = tx.getRepository(WorkShift)
20
-
21
- await workShiftRepo.delete({ domain: { id: domain.id } })
22
-
23
- for (let i = 0; i < patches.length; i++) {
24
- const patch = patches[i]
25
-
26
- const result = await workShiftRepo.save({
27
- ...patch,
28
- domain,
29
- creator: user,
30
- updater: user
31
- })
32
-
33
- results.push({ ...result, cuFlag: '+' })
34
- }
35
-
36
- return results
37
- }
38
-
39
- @Directive('@privilege(category: "work-shift", privilege: "mutation", domainOwnerGranted: true)')
40
- @Directive('@transaction')
41
- @Mutation(returns => Boolean, { description: 'To delete multiple workShifts' })
42
- async deleteWorkShifts(
43
- @Arg('ids', type => [String]) ids: string[],
44
- @Ctx() context: ResolverContext
45
- ): Promise<boolean> {
46
- const { domain, tx } = context.state
47
-
48
- await tx.getRepository(WorkShift).delete({
49
- domain: { id: domain.id },
50
- id: In(ids)
51
- })
52
-
53
- return true
54
- }
55
- }
@@ -1,67 +0,0 @@
1
- import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
-
3
- import { User } from '@things-factory/auth-base'
4
- import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
5
-
6
- import { getWorkDateAndShift } from '../../controllers/index'
7
- import { WorkShift } from './work-shift'
8
- import { WorkShiftInfo, WorkShiftList } from './work-shift-type'
9
-
10
- @Resolver(Domain)
11
- export class DomainWorkShiftQuery {
12
- @Query(returns => WorkShiftInfo, { description: 'To fetch a work date and work shift for given datetime' })
13
- async getWorkDateAndShift(@Arg('dateTime') dateTime: Date, @Ctx() context: ResolverContext): Promise<WorkShiftInfo> {
14
- const { domain } = context.state
15
-
16
- return await getWorkDateAndShift(domain, dateTime)
17
- }
18
-
19
- @FieldResolver(type => [WorkShift])
20
- async workShifts(@Root() domain: Domain): Promise<WorkShift[]> {
21
- return await getRepository(WorkShift).find({
22
- where: {
23
- domain: { id: domain.id }
24
- },
25
- order: {
26
- fromDate: 'ASC',
27
- fromTime: 'ASC'
28
- }
29
- })
30
- }
31
- }
32
-
33
- @Resolver(WorkShift)
34
- export class WorkShiftQuery {
35
- @Query(returns => WorkShiftList, { description: 'To fetch multiple WorkShifts' })
36
- async workShifts(
37
- @Args(type => ListParam) params: ListParam,
38
- @Ctx() context: ResolverContext
39
- ): Promise<WorkShiftList> {
40
- const { domain } = context.state
41
-
42
- const queryBuilder = getQueryBuilderFromListParams({
43
- repository: getRepository(WorkShift),
44
- params,
45
- domain
46
- })
47
-
48
- const [items, total] = await queryBuilder.getManyAndCount()
49
-
50
- return { items, total }
51
- }
52
-
53
- @FieldResolver(type => Domain)
54
- async domain(@Root() workShift: WorkShift): Promise<Domain> {
55
- return await getRepository(Domain).findOneBy({ id: workShift.domainId })
56
- }
57
-
58
- @FieldResolver(type => User)
59
- async updater(@Root() workShift: WorkShift): Promise<User> {
60
- return await getRepository(User).findOneBy({ id: workShift.updaterId })
61
- }
62
-
63
- @FieldResolver(type => User)
64
- async creator(@Root() workShift: WorkShift): Promise<User> {
65
- return await getRepository(User).findOneBy({ id: workShift.creatorId })
66
- }
67
- }
@@ -1,47 +0,0 @@
1
- import { Field, ID, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'
2
- import { WorkShift, WorkShiftDateType } from './work-shift'
3
-
4
- @InputType()
5
- export class WorkShiftPatch {
6
- @Field()
7
- name: string
8
-
9
- @Field({ nullable: true })
10
- description?: string
11
-
12
- @Field()
13
- fromDate: WorkShiftDateType
14
-
15
- @Field()
16
- fromTime: string
17
-
18
- @Field()
19
- toDate: WorkShiftDateType
20
-
21
- @Field()
22
- toTime: string
23
- }
24
-
25
- @ObjectType()
26
- export class WorkShiftList {
27
- @Field(type => [WorkShift])
28
- items: WorkShift[]
29
-
30
- @Field(type => Int)
31
- total: number
32
- }
33
-
34
- @ObjectType()
35
- export class WorkShiftInfo {
36
- @Field({ nullable: true })
37
- workDate?: string
38
-
39
- @Field({ nullable: true })
40
- workShift?: string
41
-
42
- @Field(type => [Date], { nullable: true })
43
- dateRange?: Date[]
44
-
45
- @Field(type => [Date], { nullable: true })
46
- shiftRange?: Date[]
47
- }