@things-factory/accounting 8.0.0 → 9.0.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js +1 -1
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -1
- package/dist-client/pages/bank/bank-importer.d.ts +23 -0
- package/dist-client/pages/bank/bank-importer.js +93 -0
- package/dist-client/pages/bank/bank-importer.js.map +1 -0
- package/dist-client/pages/bank/bank-list-page.d.ts +66 -0
- package/dist-client/pages/bank/bank-list-page.js +370 -0
- package/dist-client/pages/bank/bank-list-page.js.map +1 -0
- package/dist-client/pages/bank-account/bank-account-importer.d.ts +23 -0
- package/dist-client/pages/bank-account/bank-account-importer.js +93 -0
- package/dist-client/pages/bank-account/bank-account-importer.js.map +1 -0
- package/dist-client/pages/bank-account/bank-account-list-page.d.ts +66 -0
- package/dist-client/pages/bank-account/bank-account-list-page.js +370 -0
- package/dist-client/pages/bank-account/bank-account-list-page.js.map +1 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.d.ts +23 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.js +93 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.js.map +1 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.d.ts +66 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.js +370 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/migrations/1725201567284-seed-country-codes.d.ts +5 -0
- package/dist-server/migrations/1725201567284-seed-country-codes.js +248 -0
- package/dist-server/migrations/1725201567284-seed-country-codes.js.map +1 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.d.ts +5 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.js +348 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-history.d.ts +34 -0
- package/dist-server/service/bank-account/bank-account-history.js +172 -0
- package/dist-server/service/bank-account/bank-account-history.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-mutation.d.ts +10 -0
- package/dist-server/service/bank-account/bank-account-mutation.js +128 -0
- package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-query.d.ts +11 -0
- package/dist-server/service/bank-account/bank-account-query.js +79 -0
- package/dist-server/service/bank-account/bank-account-query.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-type.d.ts +39 -0
- package/dist-server/service/bank-account/bank-account-type.js +153 -0
- package/dist-server/service/bank-account/bank-account-type.js.map +1 -0
- package/dist-server/service/bank-account/bank-account.d.ts +38 -0
- package/dist-server/service/bank-account/bank-account.js +164 -0
- package/dist-server/service/bank-account/bank-account.js.map +1 -0
- package/dist-server/service/bank-account/event-subscriber.d.ts +7 -0
- package/dist-server/service/bank-account/event-subscriber.js +21 -0
- package/dist-server/service/bank-account/event-subscriber.js.map +1 -0
- package/dist-server/service/bank-account/index.d.ts +7 -0
- package/dist-server/service/bank-account/index.js +12 -0
- package/dist-server/service/bank-account/index.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.d.ts +10 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js +169 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-query.d.ts +12 -0
- package/dist-server/service/financial-institution/financial-institution-query.js +97 -0
- package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-type.d.ts +32 -0
- package/dist-server/service/financial-institution/financial-institution-type.js +126 -0
- package/dist-server/service/financial-institution/financial-institution-type.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution.d.ts +34 -0
- package/dist-server/service/financial-institution/financial-institution.js +137 -0
- package/dist-server/service/financial-institution/financial-institution.js.map +1 -0
- package/dist-server/service/financial-institution/index.d.ts +6 -0
- package/dist-server/service/financial-institution/index.js +10 -0
- package/dist-server/service/financial-institution/index.js.map +1 -0
- package/dist-server/service/index.d.ts +3 -2
- package/dist-server/service/index.js +5 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/payment/index.d.ts +1 -2
- package/dist-server/service/payment/payment-history.d.ts +8 -1
- package/dist-server/service/payment/payment-history.js +41 -10
- package/dist-server/service/payment/payment-history.js.map +1 -1
- package/dist-server/service/payment/payment-type.d.ts +7 -1
- package/dist-server/service/payment/payment-type.js +24 -0
- package/dist-server/service/payment/payment-type.js.map +1 -1
- package/dist-server/service/payment/payment.d.ts +12 -0
- package/dist-server/service/payment/payment.js +36 -1
- package/dist-server/service/payment/payment.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/accounting/bank-account.md +160 -0
- package/helps/accounting/bank.md +160 -0
- package/helps/accounting/financial-institution.md +160 -0
- package/package.json +7 -7
- package/client/activities/activity-book-edit.ts +0 -88
- package/client/activities/activity-book-view.ts +0 -88
- package/client/activities/activity-expense-edit.ts +0 -88
- package/client/activities/activity-expense-view.ts +0 -88
- package/client/bootstrap.ts +0 -10
- package/client/components/accounting-category-selector.ts +0 -136
- package/client/components/accounting-category-view.ts +0 -75
- package/client/grist-editors/grist-editor-accounting-category-object.ts +0 -83
- package/client/grist-editors/grist-renderer-accounting-category-object.ts +0 -13
- package/client/index.ts +0 -0
- package/client/pages/account/account-importer.ts +0 -97
- package/client/pages/account/account-list-page.ts +0 -364
- package/client/pages/accounting-category/accounting-category-importer.ts +0 -97
- package/client/pages/accounting-category/accounting-category-list-page.ts +0 -368
- package/client/pages/accounting-category/accounting-category-tree-page.ts +0 -338
- package/client/pages/accounting-document/accounting-document-importer.ts +0 -90
- package/client/pages/accounting-document/accounting-document-list-page.ts +0 -398
- package/client/pages/financial-statement/financial-statement-importer.ts +0 -97
- package/client/pages/financial-statement/financial-statement-list-page.ts +0 -338
- package/client/pages/fiscal-month/fiscal-month-importer.ts +0 -90
- package/client/pages/fiscal-month/fiscal-month-list-page.ts +0 -398
- package/client/pages/fiscal-quarter/fiscal-quarter-importer.ts +0 -90
- package/client/pages/fiscal-quarter/fiscal-quarter-list-page.ts +0 -398
- package/client/pages/fiscal-year/fiscal-year-importer.ts +0 -90
- package/client/pages/fiscal-year/fiscal-year-list-page.ts +0 -398
- package/client/pages/income-statement/income-statement-importer.ts +0 -97
- package/client/pages/income-statement/income-statement-list-page.ts +0 -338
- package/client/pages/payment/payment-importer.ts +0 -90
- package/client/pages/payment/payment-list-page.ts +0 -398
- package/client/pages/transaction/transaction-importer.ts +0 -97
- package/client/pages/transaction/transaction-list-page.ts +0 -338
- package/client/route.ts +0 -35
- package/client/tsconfig.json +0 -13
- package/client/types/accounting-category.ts +0 -23
- package/client/types/index.ts +0 -1
- package/server/activities/activity-book.ts +0 -172
- package/server/activities/activity-expense.ts +0 -149
- package/server/activities/index.ts +0 -18
- package/server/controllers/index.ts +0 -1
- package/server/controllers/summary-statements.ts +0 -166
- package/server/index.ts +0 -6
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/1725200507196-seed-fiscal-entities.ts +0 -106
- package/server/migrations/1725201467183-seed-accounts.ts +0 -339
- package/server/migrations/index.ts +0 -9
- package/server/routes.ts +0 -26
- package/server/service/account/account-history.ts +0 -117
- package/server/service/account/account-mutation.ts +0 -140
- package/server/service/account/account-query.ts +0 -51
- package/server/service/account/account-type.ts +0 -44
- package/server/service/account/account.ts +0 -97
- package/server/service/account/event-subscriber.ts +0 -17
- package/server/service/account/index.ts +0 -9
- package/server/service/accounting-category/accounting-category-history.ts +0 -129
- package/server/service/accounting-category/accounting-category-mutation.ts +0 -148
- package/server/service/accounting-category/accounting-category-query.ts +0 -74
- package/server/service/accounting-category/accounting-category-type.ts +0 -48
- package/server/service/accounting-category/accounting-category.ts +0 -100
- package/server/service/accounting-category/event-subscriber.ts +0 -20
- package/server/service/accounting-category/index.ts +0 -9
- package/server/service/accounting-document/accounting-document-history.ts +0 -123
- package/server/service/accounting-document/accounting-document-mutation.ts +0 -137
- package/server/service/accounting-document/accounting-document-query.ts +0 -48
- package/server/service/accounting-document/accounting-document-type.ts +0 -52
- package/server/service/accounting-document/accounting-document.ts +0 -93
- package/server/service/accounting-document/event-subscriber.ts +0 -17
- package/server/service/accounting-document/index.ts +0 -9
- package/server/service/common-type.ts +0 -12
- package/server/service/financial-statement/event-subscriber.ts +0 -17
- package/server/service/financial-statement/financial-statement-history.ts +0 -129
- package/server/service/financial-statement/financial-statement-line-item.ts +0 -82
- package/server/service/financial-statement/financial-statement-mutation.ts +0 -148
- package/server/service/financial-statement/financial-statement-query.ts +0 -53
- package/server/service/financial-statement/financial-statement-type.ts +0 -51
- package/server/service/financial-statement/financial-statement.ts +0 -116
- package/server/service/financial-statement/index.ts +0 -10
- package/server/service/fiscal-month/fiscal-month-mutation.ts +0 -145
- package/server/service/fiscal-month/fiscal-month-query.ts +0 -58
- package/server/service/fiscal-month/fiscal-month-type.ts +0 -66
- package/server/service/fiscal-month/fiscal-month.ts +0 -84
- package/server/service/fiscal-month/index.ts +0 -7
- package/server/service/fiscal-quarter/fiscal-quarter-mutation.ts +0 -148
- package/server/service/fiscal-quarter/fiscal-quarter-query.ts +0 -60
- package/server/service/fiscal-quarter/fiscal-quarter-type.ts +0 -60
- package/server/service/fiscal-quarter/fiscal-quarter.ts +0 -80
- package/server/service/fiscal-quarter/index.ts +0 -7
- package/server/service/fiscal-year/fiscal-year-mutation.ts +0 -145
- package/server/service/fiscal-year/fiscal-year-query.ts +0 -53
- package/server/service/fiscal-year/fiscal-year-type.ts +0 -54
- package/server/service/fiscal-year/fiscal-year.ts +0 -76
- package/server/service/fiscal-year/index.ts +0 -7
- package/server/service/income-statement/event-subscriber.ts +0 -17
- package/server/service/income-statement/income-statement-history.ts +0 -133
- package/server/service/income-statement/income-statement-line-item.ts +0 -84
- package/server/service/income-statement/income-statement-mutation.ts +0 -147
- package/server/service/income-statement/income-statement-query.ts +0 -50
- package/server/service/income-statement/income-statement-type.ts +0 -51
- package/server/service/income-statement/income-statement.ts +0 -120
- package/server/service/income-statement/index.ts +0 -10
- package/server/service/index.ts +0 -108
- package/server/service/payment/event-subscriber.ts +0 -17
- package/server/service/payment/index.ts +0 -9
- package/server/service/payment/payment-history.ts +0 -132
- package/server/service/payment/payment-mutation.ts +0 -139
- package/server/service/payment/payment-query.ts +0 -50
- package/server/service/payment/payment-type.ts +0 -64
- package/server/service/payment/payment.ts +0 -123
- package/server/service/transaction/event-subscriber.ts +0 -17
- package/server/service/transaction/index.ts +0 -9
- package/server/service/transaction/transaction-history.ts +0 -161
- package/server/service/transaction/transaction-mutation.ts +0 -146
- package/server/service/transaction/transaction-query.ts +0 -50
- package/server/service/transaction/transaction-type.ts +0 -48
- package/server/service/transaction/transaction.ts +0 -230
- package/server/tsconfig.json +0 -10
@@ -1,66 +0,0 @@
|
|
1
|
-
import { InputType, Field, Int, ID, ObjectType } from 'type-graphql'
|
2
|
-
import { FiscalStatus } from '../common-type'
|
3
|
-
import { FiscalMonth } from './fiscal-month'
|
4
|
-
|
5
|
-
@InputType()
|
6
|
-
export class NewFiscalMonth {
|
7
|
-
@Field(type => Int)
|
8
|
-
year: number // 회계연도 (예: 2023)
|
9
|
-
|
10
|
-
@Field(type => Int)
|
11
|
-
quarter: number // 1, 2, 3, 4 분기
|
12
|
-
|
13
|
-
@Field(type => Int)
|
14
|
-
month: number // 1 ~ 12월
|
15
|
-
|
16
|
-
@Field(type => String, { description: 'The start date of the fiscal month in YYYY-MM-DD format' })
|
17
|
-
startDate: string // 월의 시작일
|
18
|
-
|
19
|
-
@Field(type => String, { description: 'The end date of the fiscal month in YYYY-MM-DD format' })
|
20
|
-
endDate: string // 월의 종료일
|
21
|
-
|
22
|
-
@Field(type => FiscalStatus, { nullable: true })
|
23
|
-
status?: FiscalStatus // 월의 상태 (OPEN, CLOSED, FINALIZED)
|
24
|
-
|
25
|
-
@Field({ nullable: true })
|
26
|
-
notes?: string // 월에 대한 설명이나 주석
|
27
|
-
}
|
28
|
-
|
29
|
-
@InputType()
|
30
|
-
export class FiscalMonthPatch {
|
31
|
-
@Field(type => ID, { nullable: true })
|
32
|
-
id?: string
|
33
|
-
|
34
|
-
@Field(type => Int, { nullable: true })
|
35
|
-
year?: number // 회계연도 (예: 2023)
|
36
|
-
|
37
|
-
@Field(type => Int, { nullable: true })
|
38
|
-
quarter?: number // 1, 2, 3, 4 분기
|
39
|
-
|
40
|
-
@Field(type => Int, { nullable: true })
|
41
|
-
month?: number // 1 ~ 12월
|
42
|
-
|
43
|
-
@Field(type => String, { description: 'The start date of the fiscal month in YYYY-MM-DD format' })
|
44
|
-
startDate: string // 월의 시작일
|
45
|
-
|
46
|
-
@Field(type => String, { description: 'The end date of the fiscal month in YYYY-MM-DD format' })
|
47
|
-
endDate: string // 월의 종료일
|
48
|
-
|
49
|
-
@Field(type => FiscalStatus, { nullable: true })
|
50
|
-
status?: FiscalStatus // 월의 상태 (OPEN, CLOSED, FINALIZED)
|
51
|
-
|
52
|
-
@Field({ nullable: true })
|
53
|
-
notes?: string // 월에 대한 설명이나 주석
|
54
|
-
|
55
|
-
@Field({ nullable: true })
|
56
|
-
cuFlag?: string // Create/Update Flag
|
57
|
-
}
|
58
|
-
|
59
|
-
@ObjectType()
|
60
|
-
export class FiscalMonthList {
|
61
|
-
@Field(type => [FiscalMonth])
|
62
|
-
items: FiscalMonth[]
|
63
|
-
|
64
|
-
@Field(type => Int)
|
65
|
-
total: number
|
66
|
-
}
|
@@ -1,84 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
CreateDateColumn,
|
3
|
-
DeleteDateColumn,
|
4
|
-
UpdateDateColumn,
|
5
|
-
Entity,
|
6
|
-
Index,
|
7
|
-
Column,
|
8
|
-
ManyToOne,
|
9
|
-
RelationId,
|
10
|
-
PrimaryGeneratedColumn
|
11
|
-
} from 'typeorm'
|
12
|
-
import { ObjectType, Field, Int, ID } from 'type-graphql'
|
13
|
-
import { Domain } from '@things-factory/shell'
|
14
|
-
import { User } from '@things-factory/auth-base'
|
15
|
-
import { FiscalStatus } from '../common-type'
|
16
|
-
|
17
|
-
@ObjectType({ description: 'Entity representing a fiscal month' })
|
18
|
-
@Entity()
|
19
|
-
export class FiscalMonth {
|
20
|
-
@PrimaryGeneratedColumn('uuid')
|
21
|
-
@Field(type => ID)
|
22
|
-
readonly id: string
|
23
|
-
|
24
|
-
@ManyToOne(type => Domain)
|
25
|
-
@Field({ nullable: true })
|
26
|
-
domain?: Domain
|
27
|
-
|
28
|
-
@RelationId((fiscalMonth: FiscalMonth) => fiscalMonth.domain)
|
29
|
-
domainId?: string
|
30
|
-
|
31
|
-
@Column()
|
32
|
-
@Field(type => Int, { description: 'The fiscal year (e.g., 2023)' })
|
33
|
-
year: number // 회계연도 (예: 2023)
|
34
|
-
|
35
|
-
@Column()
|
36
|
-
@Field(type => Int, { description: 'The quarter number (1, 2, 3, or 4)' })
|
37
|
-
quarter: number // 1, 2, 3, 4 분기
|
38
|
-
|
39
|
-
@Column()
|
40
|
-
@Field(type => Int, { description: 'The month number (1 to 12)' })
|
41
|
-
month: number // 1 ~ 12월
|
42
|
-
|
43
|
-
@Column()
|
44
|
-
@Field(type => String, { description: 'The start date of the fiscal month in YYYY-MM-DD format' })
|
45
|
-
startDate: string // 월의 시작일
|
46
|
-
|
47
|
-
@Column()
|
48
|
-
@Field(type => String, { description: 'The end date of the fiscal month in YYYY-MM-DD format' })
|
49
|
-
endDate: string // 월의 종료일
|
50
|
-
|
51
|
-
@Column({ default: FiscalStatus.OPEN })
|
52
|
-
@Field(type => FiscalStatus, { description: 'The status of the fiscal month (OPEN, CLOSED, FINALIZED)' })
|
53
|
-
status: FiscalStatus // 월의 상태 (OPEN, CLOSED, FINALIZED)
|
54
|
-
|
55
|
-
@Column({ nullable: true })
|
56
|
-
@Field({ nullable: true, description: 'Notes or comments about the fiscal month' })
|
57
|
-
notes?: string // 월에 대한 설명이나 주석
|
58
|
-
|
59
|
-
@CreateDateColumn()
|
60
|
-
@Field({ nullable: true })
|
61
|
-
createdAt?: Date
|
62
|
-
|
63
|
-
@UpdateDateColumn()
|
64
|
-
@Field({ nullable: true })
|
65
|
-
updatedAt?: Date
|
66
|
-
|
67
|
-
@DeleteDateColumn()
|
68
|
-
@Field({ nullable: true })
|
69
|
-
deletedAt?: Date
|
70
|
-
|
71
|
-
@ManyToOne(type => User, { nullable: true })
|
72
|
-
@Field(type => User, { nullable: true })
|
73
|
-
creator?: User
|
74
|
-
|
75
|
-
@RelationId((fiscalMonth: FiscalMonth) => fiscalMonth.creator)
|
76
|
-
creatorId?: string
|
77
|
-
|
78
|
-
@ManyToOne(type => User, { nullable: true })
|
79
|
-
@Field(type => User, { nullable: true })
|
80
|
-
updater?: User
|
81
|
-
|
82
|
-
@RelationId((fiscalMonth: FiscalMonth) => fiscalMonth.updater)
|
83
|
-
updaterId?: string
|
84
|
-
}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { FiscalMonth } from './fiscal-month'
|
2
|
-
import { FiscalMonthQuery } from './fiscal-month-query'
|
3
|
-
import { FiscalMonthMutation } from './fiscal-month-mutation'
|
4
|
-
|
5
|
-
export const entities = [FiscalMonth]
|
6
|
-
export const resolvers = [FiscalMonthQuery, FiscalMonthMutation]
|
7
|
-
export const subscribers = []
|
@@ -1,148 +0,0 @@
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
2
|
-
import { In } from 'typeorm'
|
3
|
-
import { getRepository } from '@things-factory/shell'
|
4
|
-
|
5
|
-
import { FiscalQuarter } from './fiscal-quarter'
|
6
|
-
import { NewFiscalQuarter, FiscalQuarterPatch } from './fiscal-quarter-type'
|
7
|
-
|
8
|
-
@Resolver(FiscalQuarter)
|
9
|
-
export class FiscalQuarterMutation {
|
10
|
-
@Directive('@transaction')
|
11
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
12
|
-
@Mutation(returns => FiscalQuarter, { description: 'To create new FiscalQuarter' })
|
13
|
-
async createFiscalQuarter(
|
14
|
-
@Arg('fiscalQuarter') fiscalQuarter: NewFiscalQuarter,
|
15
|
-
@Ctx() context: ResolverContext
|
16
|
-
): Promise<FiscalQuarter> {
|
17
|
-
const { domain, user, tx } = context.state
|
18
|
-
|
19
|
-
const result = await getRepository(FiscalQuarter, tx).save({
|
20
|
-
...fiscalQuarter,
|
21
|
-
domain,
|
22
|
-
creator: user,
|
23
|
-
updater: user
|
24
|
-
})
|
25
|
-
|
26
|
-
return result
|
27
|
-
}
|
28
|
-
|
29
|
-
@Directive('@transaction')
|
30
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
31
|
-
@Mutation(returns => FiscalQuarter, { description: 'To modify FiscalQuarter information' })
|
32
|
-
async updateFiscalQuarter(
|
33
|
-
@Arg('id') id: string,
|
34
|
-
@Arg('patch') patch: FiscalQuarterPatch,
|
35
|
-
@Ctx() context: ResolverContext
|
36
|
-
): Promise<FiscalQuarter> {
|
37
|
-
const { domain, user, tx } = context.state
|
38
|
-
|
39
|
-
const repository = getRepository(FiscalQuarter, tx)
|
40
|
-
const fiscalQuarter = await repository.findOne({
|
41
|
-
where: { domain: { id: domain.id }, id }
|
42
|
-
})
|
43
|
-
|
44
|
-
const result = await repository.save({
|
45
|
-
...fiscalQuarter,
|
46
|
-
...patch,
|
47
|
-
updater: user
|
48
|
-
})
|
49
|
-
|
50
|
-
return result
|
51
|
-
}
|
52
|
-
|
53
|
-
@Directive('@transaction')
|
54
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
55
|
-
@Mutation(returns => [FiscalQuarter], { description: "To modify multiple FiscalQuarters' information" })
|
56
|
-
async updateMultipleFiscalQuarter(
|
57
|
-
@Arg('patches', type => [FiscalQuarterPatch]) patches: FiscalQuarterPatch[],
|
58
|
-
@Ctx() context: ResolverContext
|
59
|
-
): Promise<FiscalQuarter[]> {
|
60
|
-
const { domain, user, tx } = context.state
|
61
|
-
|
62
|
-
let results = []
|
63
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
64
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
65
|
-
const fiscalQuarterRepo = getRepository(FiscalQuarter, tx)
|
66
|
-
|
67
|
-
if (_createRecords.length > 0) {
|
68
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
69
|
-
const newRecord = _createRecords[i]
|
70
|
-
|
71
|
-
const result = await fiscalQuarterRepo.save({
|
72
|
-
...newRecord,
|
73
|
-
domain,
|
74
|
-
creator: user,
|
75
|
-
updater: user
|
76
|
-
})
|
77
|
-
|
78
|
-
results.push({ ...result, cuFlag: '+' })
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
if (_updateRecords.length > 0) {
|
83
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
84
|
-
const updateRecord = _updateRecords[i]
|
85
|
-
const fiscalQuarter = await fiscalQuarterRepo.findOneBy({ id: updateRecord.id })
|
86
|
-
|
87
|
-
const result = await fiscalQuarterRepo.save({
|
88
|
-
...fiscalQuarter,
|
89
|
-
...updateRecord,
|
90
|
-
updater: user
|
91
|
-
})
|
92
|
-
|
93
|
-
results.push({ ...result, cuFlag: 'M' })
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
return results
|
98
|
-
}
|
99
|
-
|
100
|
-
@Directive('@transaction')
|
101
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
102
|
-
@Mutation(returns => Boolean, { description: 'To delete FiscalQuarter' })
|
103
|
-
async deleteFiscalQuarter(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
104
|
-
const { domain, tx } = context.state
|
105
|
-
|
106
|
-
await getRepository(FiscalQuarter, tx).delete({ domain: { id: domain.id }, id })
|
107
|
-
|
108
|
-
return true
|
109
|
-
}
|
110
|
-
|
111
|
-
@Directive('@transaction')
|
112
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
113
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple FiscalQuarters' })
|
114
|
-
async deleteFiscalQuarters(
|
115
|
-
@Arg('ids', type => [String]) ids: string[],
|
116
|
-
@Ctx() context: ResolverContext
|
117
|
-
): Promise<boolean> {
|
118
|
-
const { domain, tx } = context.state
|
119
|
-
|
120
|
-
await getRepository(FiscalQuarter, tx).delete({
|
121
|
-
domain: { id: domain.id },
|
122
|
-
id: In(ids)
|
123
|
-
})
|
124
|
-
|
125
|
-
return true
|
126
|
-
}
|
127
|
-
|
128
|
-
@Directive('@transaction')
|
129
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
130
|
-
@Mutation(returns => Boolean, { description: 'To import multiple FiscalQuarters' })
|
131
|
-
async importFiscalQuarters(
|
132
|
-
@Arg('fiscalQuarters', type => [FiscalQuarterPatch]) fiscalQuarters: FiscalQuarterPatch[],
|
133
|
-
@Ctx() context: ResolverContext
|
134
|
-
): Promise<boolean> {
|
135
|
-
const { domain, tx } = context.state
|
136
|
-
|
137
|
-
await Promise.all(
|
138
|
-
fiscalQuarters.map(async (fiscalQuarter: FiscalQuarterPatch) => {
|
139
|
-
const createdFiscalQuarter: FiscalQuarter = await getRepository(FiscalQuarter, tx).save({
|
140
|
-
domain,
|
141
|
-
...fiscalQuarter
|
142
|
-
})
|
143
|
-
})
|
144
|
-
)
|
145
|
-
|
146
|
-
return true
|
147
|
-
}
|
148
|
-
}
|
@@ -1,60 +0,0 @@
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
|
2
|
-
import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
3
|
-
import { User } from '@things-factory/auth-base'
|
4
|
-
import { FiscalQuarter } from './fiscal-quarter'
|
5
|
-
import { FiscalQuarterList } from './fiscal-quarter-type'
|
6
|
-
|
7
|
-
@Resolver(FiscalQuarter)
|
8
|
-
export class FiscalQuarterQuery {
|
9
|
-
@Directive('@privilege(category: "accounting", privilege: "query")')
|
10
|
-
@Query(returns => FiscalQuarter!, {
|
11
|
-
nullable: true,
|
12
|
-
description: 'To fetch a FiscalQuarter by year and quarter number'
|
13
|
-
})
|
14
|
-
async fiscalQuarter(
|
15
|
-
@Arg('year') year: number,
|
16
|
-
@Arg('quarter') quarter: number,
|
17
|
-
@Ctx() context: ResolverContext
|
18
|
-
): Promise<FiscalQuarter | undefined> {
|
19
|
-
const { domain } = context.state
|
20
|
-
|
21
|
-
return await getRepository(FiscalQuarter).findOne({
|
22
|
-
where: { domain: { id: domain.id }, year, quarter }
|
23
|
-
})
|
24
|
-
}
|
25
|
-
|
26
|
-
@Directive('@privilege(category: "accounting", privilege: "query")')
|
27
|
-
@Query(returns => FiscalQuarterList, { description: 'To fetch multiple FiscalQuarters' })
|
28
|
-
async fiscalQuarters(
|
29
|
-
@Args(type => ListParam) params: ListParam,
|
30
|
-
@Ctx() context: ResolverContext
|
31
|
-
): Promise<FiscalQuarterList> {
|
32
|
-
const { domain } = context.state
|
33
|
-
|
34
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
35
|
-
domain,
|
36
|
-
params,
|
37
|
-
repository: await getRepository(FiscalQuarter),
|
38
|
-
searchables: []
|
39
|
-
})
|
40
|
-
|
41
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
42
|
-
|
43
|
-
return { items, total }
|
44
|
-
}
|
45
|
-
|
46
|
-
@FieldResolver(type => Domain)
|
47
|
-
async domain(@Root() fiscalQuarter: FiscalQuarter): Promise<Domain> {
|
48
|
-
return fiscalQuarter.domainId && (await getRepository(Domain).findOneBy({ id: fiscalQuarter.domainId }))
|
49
|
-
}
|
50
|
-
|
51
|
-
@FieldResolver(type => User)
|
52
|
-
async updater(@Root() fiscalQuarter: FiscalQuarter): Promise<User> {
|
53
|
-
return fiscalQuarter.updaterId && (await getRepository(User).findOneBy({ id: fiscalQuarter.updaterId }))
|
54
|
-
}
|
55
|
-
|
56
|
-
@FieldResolver(type => User)
|
57
|
-
async creator(@Root() fiscalQuarter: FiscalQuarter): Promise<User> {
|
58
|
-
return fiscalQuarter.creatorId && (await getRepository(User).findOneBy({ id: fiscalQuarter.creatorId }))
|
59
|
-
}
|
60
|
-
}
|
@@ -1,60 +0,0 @@
|
|
1
|
-
import { InputType, Field, Int, ID, ObjectType } from 'type-graphql'
|
2
|
-
import { FiscalStatus } from '../common-type'
|
3
|
-
import { FiscalQuarter } from './fiscal-quarter'
|
4
|
-
|
5
|
-
@InputType()
|
6
|
-
export class NewFiscalQuarter {
|
7
|
-
@Field(type => Int)
|
8
|
-
year: number // 회계연도 (예: 2023)
|
9
|
-
|
10
|
-
@Field(type => Int)
|
11
|
-
quarter: number // 1, 2, 3, 4 분기
|
12
|
-
|
13
|
-
@Field(type => String, { description: 'The start date of the fiscal month in YYYY-MM-DD format' })
|
14
|
-
startDate: string // 월의 시작일
|
15
|
-
|
16
|
-
@Field(type => String, { description: 'The end date of the fiscal month in YYYY-MM-DD format' })
|
17
|
-
endDate: string // 월의 종료일
|
18
|
-
|
19
|
-
@Field(type => FiscalStatus, { nullable: true })
|
20
|
-
status?: FiscalStatus // 분기의 상태 (OPEN, CLOSED, FINALIZED)
|
21
|
-
|
22
|
-
@Field({ nullable: true })
|
23
|
-
notes?: string // 분기에 대한 설명이나 주석
|
24
|
-
}
|
25
|
-
|
26
|
-
@InputType()
|
27
|
-
export class FiscalQuarterPatch {
|
28
|
-
@Field(type => ID, { nullable: true })
|
29
|
-
id?: string
|
30
|
-
|
31
|
-
@Field(type => Int, { nullable: true })
|
32
|
-
year?: number // 회계연도 (예: 2023)
|
33
|
-
|
34
|
-
@Field(type => Int, { nullable: true })
|
35
|
-
quarter?: number // 1, 2, 3, 4 분기
|
36
|
-
|
37
|
-
@Field(type => String, { description: 'The start date of the fiscal month in YYYY-MM-DD format' })
|
38
|
-
startDate: string // 월의 시작일
|
39
|
-
|
40
|
-
@Field(type => String, { description: 'The end date of the fiscal month in YYYY-MM-DD format' })
|
41
|
-
endDate: string // 월의 종료일
|
42
|
-
|
43
|
-
@Field(type => FiscalStatus, { nullable: true })
|
44
|
-
status?: FiscalStatus // 분기의 상태 (OPEN, CLOSED, FINALIZED)
|
45
|
-
|
46
|
-
@Field({ nullable: true })
|
47
|
-
notes?: string // 분기에 대한 설명이나 주석
|
48
|
-
|
49
|
-
@Field({ nullable: true })
|
50
|
-
cuFlag?: string // Create/Update Flag
|
51
|
-
}
|
52
|
-
|
53
|
-
@ObjectType()
|
54
|
-
export class FiscalQuarterList {
|
55
|
-
@Field(type => [FiscalQuarter])
|
56
|
-
items: FiscalQuarter[]
|
57
|
-
|
58
|
-
@Field(type => Int)
|
59
|
-
total: number
|
60
|
-
}
|
@@ -1,80 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
CreateDateColumn,
|
3
|
-
DeleteDateColumn,
|
4
|
-
UpdateDateColumn,
|
5
|
-
Entity,
|
6
|
-
Index,
|
7
|
-
Column,
|
8
|
-
ManyToOne,
|
9
|
-
RelationId,
|
10
|
-
PrimaryGeneratedColumn
|
11
|
-
} from 'typeorm'
|
12
|
-
import { ObjectType, Field, Int, ID } from 'type-graphql'
|
13
|
-
import { Domain } from '@things-factory/shell'
|
14
|
-
import { User } from '@things-factory/auth-base'
|
15
|
-
import { FiscalStatus } from '../common-type'
|
16
|
-
|
17
|
-
@ObjectType({ description: 'Entity representing a fiscal quarter' })
|
18
|
-
@Entity()
|
19
|
-
export class FiscalQuarter {
|
20
|
-
@PrimaryGeneratedColumn('uuid')
|
21
|
-
@Field(type => ID)
|
22
|
-
readonly id: string
|
23
|
-
|
24
|
-
@ManyToOne(type => Domain)
|
25
|
-
@Field({ nullable: true })
|
26
|
-
domain?: Domain
|
27
|
-
|
28
|
-
@RelationId((fiscalQuarter: FiscalQuarter) => fiscalQuarter.domain)
|
29
|
-
domainId?: string
|
30
|
-
|
31
|
-
@Column()
|
32
|
-
@Field(type => Int, { description: 'The fiscal year (e.g., 2023)' })
|
33
|
-
year: number // 회계연도 (예: 2023)
|
34
|
-
|
35
|
-
@Column()
|
36
|
-
@Field(type => Int, { description: 'The quarter number (1, 2, 3, or 4)' })
|
37
|
-
quarter: number // 1, 2, 3, 4 분기
|
38
|
-
|
39
|
-
@Column()
|
40
|
-
@Field(type => String, { description: 'The start date of the fiscal quarter in YYYY-MM-DD format' })
|
41
|
-
startDate: string // 분기 시작일
|
42
|
-
|
43
|
-
@Column()
|
44
|
-
@Field(type => String, { description: 'The end date of the fiscal quarter in YYYY-MM-DD format' })
|
45
|
-
endDate: string // 분기 종료일
|
46
|
-
|
47
|
-
@Column({ default: FiscalStatus.OPEN })
|
48
|
-
@Field(type => FiscalStatus, { description: 'The status of the fiscal quarter (OPEN, CLOSED, FINALIZED)' })
|
49
|
-
status: FiscalStatus // 분기의 상태 (OPEN, CLOSED, FINALIZED)
|
50
|
-
|
51
|
-
@Column({ nullable: true })
|
52
|
-
@Field({ nullable: true, description: 'Notes or comments about the fiscal quarter' })
|
53
|
-
notes?: string // 분기에 대한 설명이나 주석
|
54
|
-
|
55
|
-
@CreateDateColumn()
|
56
|
-
@Field({ nullable: true })
|
57
|
-
createdAt?: Date
|
58
|
-
|
59
|
-
@UpdateDateColumn()
|
60
|
-
@Field({ nullable: true })
|
61
|
-
updatedAt?: Date
|
62
|
-
|
63
|
-
@DeleteDateColumn()
|
64
|
-
@Field({ nullable: true })
|
65
|
-
deletedAt?: Date
|
66
|
-
|
67
|
-
@ManyToOne(type => User, { nullable: true })
|
68
|
-
@Field(type => User, { nullable: true })
|
69
|
-
creator?: User
|
70
|
-
|
71
|
-
@RelationId((fiscalQuarter: FiscalQuarter) => fiscalQuarter.creator)
|
72
|
-
creatorId?: string
|
73
|
-
|
74
|
-
@ManyToOne(type => User, { nullable: true })
|
75
|
-
@Field(type => User, { nullable: true })
|
76
|
-
updater?: User
|
77
|
-
|
78
|
-
@RelationId((fiscalQuarter: FiscalQuarter) => fiscalQuarter.updater)
|
79
|
-
updaterId?: string
|
80
|
-
}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { FiscalQuarter } from './fiscal-quarter'
|
2
|
-
import { FiscalQuarterQuery } from './fiscal-quarter-query'
|
3
|
-
import { FiscalQuarterMutation } from './fiscal-quarter-mutation'
|
4
|
-
|
5
|
-
export const entities = [FiscalQuarter]
|
6
|
-
export const resolvers = [FiscalQuarterQuery, FiscalQuarterMutation]
|
7
|
-
export const subscribers = []
|
@@ -1,145 +0,0 @@
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
2
|
-
import { In } from 'typeorm'
|
3
|
-
import { getRepository } from '@things-factory/shell'
|
4
|
-
|
5
|
-
import { FiscalYear } from './fiscal-year'
|
6
|
-
import { NewFiscalYear, FiscalYearPatch } from './fiscal-year-type'
|
7
|
-
|
8
|
-
@Resolver(FiscalYear)
|
9
|
-
export class FiscalYearMutation {
|
10
|
-
@Directive('@transaction')
|
11
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
12
|
-
@Mutation(returns => FiscalYear, { description: 'To create new FiscalYear' })
|
13
|
-
async createFiscalYear(
|
14
|
-
@Arg('fiscalYear') fiscalYear: NewFiscalYear,
|
15
|
-
@Ctx() context: ResolverContext
|
16
|
-
): Promise<FiscalYear> {
|
17
|
-
const { domain, user, tx } = context.state
|
18
|
-
|
19
|
-
const result = await getRepository(FiscalYear, tx).save({
|
20
|
-
...fiscalYear,
|
21
|
-
domain,
|
22
|
-
creator: user,
|
23
|
-
updater: user
|
24
|
-
})
|
25
|
-
|
26
|
-
return result
|
27
|
-
}
|
28
|
-
|
29
|
-
@Directive('@transaction')
|
30
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
31
|
-
@Mutation(returns => FiscalYear, { description: 'To modify FiscalYear information' })
|
32
|
-
async updateFiscalYear(
|
33
|
-
@Arg('id') id: string,
|
34
|
-
@Arg('patch') patch: FiscalYearPatch,
|
35
|
-
@Ctx() context: ResolverContext
|
36
|
-
): Promise<FiscalYear> {
|
37
|
-
const { domain, user, tx } = context.state
|
38
|
-
|
39
|
-
const repository = getRepository(FiscalYear, tx)
|
40
|
-
const fiscalYear = await repository.findOne({
|
41
|
-
where: { domain: { id: domain.id }, id }
|
42
|
-
})
|
43
|
-
|
44
|
-
const result = await repository.save({
|
45
|
-
...fiscalYear,
|
46
|
-
...patch,
|
47
|
-
updater: user
|
48
|
-
})
|
49
|
-
|
50
|
-
return result
|
51
|
-
}
|
52
|
-
|
53
|
-
@Directive('@transaction')
|
54
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
55
|
-
@Mutation(returns => [FiscalYear], { description: "To modify multiple FiscalYears' information" })
|
56
|
-
async updateMultipleFiscalYear(
|
57
|
-
@Arg('patches', type => [FiscalYearPatch]) patches: FiscalYearPatch[],
|
58
|
-
@Ctx() context: ResolverContext
|
59
|
-
): Promise<FiscalYear[]> {
|
60
|
-
const { domain, user, tx } = context.state
|
61
|
-
|
62
|
-
let results = []
|
63
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
64
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
65
|
-
const fiscalYearRepo = getRepository(FiscalYear, tx)
|
66
|
-
|
67
|
-
if (_createRecords.length > 0) {
|
68
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
69
|
-
const newRecord = _createRecords[i]
|
70
|
-
|
71
|
-
const result = await fiscalYearRepo.save({
|
72
|
-
...newRecord,
|
73
|
-
domain,
|
74
|
-
creator: user,
|
75
|
-
updater: user
|
76
|
-
})
|
77
|
-
|
78
|
-
results.push({ ...result, cuFlag: '+' })
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
if (_updateRecords.length > 0) {
|
83
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
84
|
-
const updateRecord = _updateRecords[i]
|
85
|
-
const fiscalYear = await fiscalYearRepo.findOneBy({ id: updateRecord.id })
|
86
|
-
|
87
|
-
const result = await fiscalYearRepo.save({
|
88
|
-
...fiscalYear,
|
89
|
-
...updateRecord,
|
90
|
-
updater: user
|
91
|
-
})
|
92
|
-
|
93
|
-
results.push({ ...result, cuFlag: 'M' })
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
return results
|
98
|
-
}
|
99
|
-
|
100
|
-
@Directive('@transaction')
|
101
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
102
|
-
@Mutation(returns => Boolean, { description: 'To delete FiscalYear' })
|
103
|
-
async deleteFiscalYear(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
104
|
-
const { domain, tx } = context.state
|
105
|
-
|
106
|
-
await getRepository(FiscalYear, tx).delete({ domain: { id: domain.id }, id })
|
107
|
-
|
108
|
-
return true
|
109
|
-
}
|
110
|
-
|
111
|
-
@Directive('@transaction')
|
112
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
113
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple FiscalYears' })
|
114
|
-
async deleteFiscalYears(
|
115
|
-
@Arg('ids', type => [String]) ids: string[],
|
116
|
-
@Ctx() context: ResolverContext
|
117
|
-
): Promise<boolean> {
|
118
|
-
const { domain, tx } = context.state
|
119
|
-
|
120
|
-
await getRepository(FiscalYear, tx).delete({
|
121
|
-
domain: { id: domain.id },
|
122
|
-
id: In(ids)
|
123
|
-
})
|
124
|
-
|
125
|
-
return true
|
126
|
-
}
|
127
|
-
|
128
|
-
@Directive('@transaction')
|
129
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
130
|
-
@Mutation(returns => Boolean, { description: 'To import multiple FiscalYears' })
|
131
|
-
async importFiscalYears(
|
132
|
-
@Arg('fiscalYears', type => [FiscalYearPatch]) fiscalYears: FiscalYearPatch[],
|
133
|
-
@Ctx() context: ResolverContext
|
134
|
-
): Promise<boolean> {
|
135
|
-
const { domain, tx } = context.state
|
136
|
-
|
137
|
-
await Promise.all(
|
138
|
-
fiscalYears.map(async (fiscalYear: FiscalYearPatch) => {
|
139
|
-
const createdFiscalYear: FiscalYear = await getRepository(FiscalYear, tx).save({ domain, ...fiscalYear })
|
140
|
-
})
|
141
|
-
)
|
142
|
-
|
143
|
-
return true
|
144
|
-
}
|
145
|
-
}
|