@things-factory/board-service 8.0.0 → 9.0.0-beta.3

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.
Files changed (64) hide show
  1. package/dist-server/controllers/headless-pdf-to-image.js +7 -2
  2. package/dist-server/controllers/headless-pdf-to-image.js.map +1 -1
  3. package/dist-server/tsconfig.tsbuildinfo +1 -1
  4. package/package.json +7 -7
  5. package/views/internal-board-full-feature-view.html +1 -1
  6. package/server/constants/error-code.ts +0 -2
  7. package/server/controllers/analyzer/analyze-integration.ts +0 -142
  8. package/server/controllers/fonts.ts +0 -83
  9. package/server/controllers/headless-model.ts +0 -53
  10. package/server/controllers/headless-pdf-to-image.ts +0 -103
  11. package/server/controllers/headless-playlist.ts +0 -71
  12. package/server/controllers/headless-pool-for-board.ts +0 -71
  13. package/server/controllers/headless-pool-for-label.ts +0 -141
  14. package/server/controllers/index.ts +0 -11
  15. package/server/controllers/label-command.ts +0 -62
  16. package/server/controllers/pdf.ts +0 -132
  17. package/server/controllers/screenshot.ts +0 -127
  18. package/server/controllers/thumbnail.ts +0 -18
  19. package/server/errors/index.ts +0 -1
  20. package/server/errors/license-error.ts +0 -21
  21. package/server/index.ts +0 -36
  22. package/server/migrations/1556862253000-SeedGroup.ts +0 -51
  23. package/server/migrations/index.ts +0 -9
  24. package/server/routers/internal-board-view-router.ts +0 -33
  25. package/server/routers/standalone-board-service-router.ts +0 -326
  26. package/server/routes.ts +0 -25
  27. package/server/service/analysis/analysis-query.ts +0 -13
  28. package/server/service/analysis/index.ts +0 -3
  29. package/server/service/board/board-history.ts +0 -137
  30. package/server/service/board/board-mutation.ts +0 -446
  31. package/server/service/board/board-query.ts +0 -180
  32. package/server/service/board/board-subscription.ts +0 -43
  33. package/server/service/board/board-type.ts +0 -58
  34. package/server/service/board/board.ts +0 -125
  35. package/server/service/board/event-subscriber.ts +0 -68
  36. package/server/service/board/index.ts +0 -10
  37. package/server/service/board-favorite/board-favorite-query.ts +0 -53
  38. package/server/service/board-favorite/board-favorite-type.ts +0 -18
  39. package/server/service/board-favorite/index.ts +0 -4
  40. package/server/service/board-template/board-template-mutation.ts +0 -161
  41. package/server/service/board-template/board-template-query.ts +0 -121
  42. package/server/service/board-template/board-template-type.ts +0 -53
  43. package/server/service/board-template/board-template.ts +0 -114
  44. package/server/service/board-template/index.ts +0 -7
  45. package/server/service/group/group-mutation.ts +0 -82
  46. package/server/service/group/group-query.ts +0 -58
  47. package/server/service/group/group-type.ts +0 -30
  48. package/server/service/group/group.ts +0 -69
  49. package/server/service/group/index.ts +0 -6
  50. package/server/service/index.ts +0 -56
  51. package/server/service/permission/domain-permission-subscriber.ts +0 -27
  52. package/server/service/permission/index.ts +0 -3
  53. package/server/service/play-group/event-subscriber.ts +0 -58
  54. package/server/service/play-group/index.ts +0 -9
  55. package/server/service/play-group/play-group-mutation.ts +0 -148
  56. package/server/service/play-group/play-group-query.ts +0 -92
  57. package/server/service/play-group/play-group-subscription.ts +0 -43
  58. package/server/service/play-group/play-group-type.ts +0 -30
  59. package/server/service/play-group/play-group.ts +0 -74
  60. package/server/service/theme/index.ts +0 -7
  61. package/server/service/theme/theme-mutation.ts +0 -128
  62. package/server/service/theme/theme-query.ts +0 -48
  63. package/server/service/theme/theme-type.ts +0 -55
  64. package/server/service/theme/theme.ts +0 -97
@@ -1,92 +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 { Board } from '../board/board'
7
- import { PlayGroup } from './play-group'
8
- import { PlayGroupList } from './play-group-type'
9
-
10
- @Resolver(PlayGroup)
11
- export class PlayGroupQuery {
12
- @Query(returns => PlayGroup, { nullable: true, description: 'To fetch a PlayGroup' })
13
- async playGroup(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<PlayGroup> {
14
- const { domain } = context.state
15
-
16
- return await getRepository(PlayGroup).findOne({
17
- where: { domain: { id: domain.id }, id }
18
- })
19
- }
20
-
21
- @Query(returns => PlayGroup, { nullable: true, description: 'To fetch a PlayGroup by name' })
22
- async playGroupByName(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<PlayGroup> {
23
- const { domain } = context.state
24
-
25
- return await getRepository(PlayGroup).findOne({
26
- where: { domain: { id: domain.id }, name }
27
- })
28
- }
29
-
30
- @Query(returns => PlayGroupList, { description: 'To fetch multiple PlayGroups' })
31
- async playGroups(
32
- @Args(type => ListParam) params: ListParam,
33
- @Ctx() context: ResolverContext
34
- ): Promise<PlayGroupList> {
35
- const { domain } = context.state
36
-
37
- const queryBuilder = getQueryBuilderFromListParams({
38
- repository: getRepository(PlayGroup),
39
- params,
40
- domain,
41
- searchables: ['name', 'description']
42
- })
43
-
44
- const [items, total] = await queryBuilder.getManyAndCount()
45
-
46
- return { items, total }
47
- }
48
-
49
- @FieldResolver(type => [Board])
50
- async boards(@Root() playGroup) {
51
- const { order = [], boards = [] } = await getRepository(PlayGroup).findOne({
52
- where: { id: playGroup.id },
53
- relations: ['boards']
54
- })
55
-
56
- return boards.sort((a, b) => {
57
- // 배열 A에 포함된 아이디의 순서를 가져옵니다.
58
- const indexOfOrder = (order || []).indexOf(a.id)
59
- const indexOfBoards = (order || []).indexOf(b.id)
60
-
61
- // 두 아이디의 순서를 비교하여 정렬합니다.
62
- if (indexOfOrder === -1 && indexOfBoards === -1) {
63
- // 두 아이디 모두 배열 A에 없는 경우, 그대로 유지합니다.
64
- return 0
65
- } else if (indexOfOrder === -1) {
66
- // 아이디 A만 배열 A에 없는 경우, 아이디 B를 먼저 정렬합니다.
67
- return 1
68
- } else if (indexOfBoards === -1) {
69
- // 아이디 B만 배열 A에 없는 경우, 아이디 A를 먼저 정렬합니다.
70
- return -1
71
- } else {
72
- // 두 아이디 모두 배열 A에 있는 경우, 배열 A의 아이디 순서대로 정렬합니다.
73
- return indexOfOrder - indexOfBoards
74
- }
75
- })
76
- }
77
-
78
- @FieldResolver(type => Domain)
79
- async domain(@Root() playGroup: PlayGroup) {
80
- return await getRepository(Domain).findOneBy({ id: playGroup.domainId })
81
- }
82
-
83
- @FieldResolver(type => User)
84
- async updater(@Root() playGroup: PlayGroup): Promise<User> {
85
- return await getRepository(User).findOneBy({ id: playGroup.updaterId })
86
- }
87
-
88
- @FieldResolver(type => User)
89
- async creator(@Root() playGroup: PlayGroup): Promise<User> {
90
- return await getRepository(User).findOneBy({ id: playGroup.creatorId })
91
- }
92
- }
@@ -1,43 +0,0 @@
1
- import { Resolver, Subscription, Root, Arg } from 'type-graphql'
2
- import { filter, pipe } from 'graphql-yoga'
3
- import { pubsub } from '@things-factory/shell'
4
- import { PlayGroup } from './play-group'
5
-
6
- @Resolver(PlayGroup)
7
- export class PlayGroupSubscription {
8
- @Subscription({
9
- subscribe: ({ args, context, info }) => {
10
- const { domain, user } = context.state
11
- const { id } = args
12
- const subdomain = domain?.subdomain
13
-
14
- if (!domain) {
15
- throw new Error('domain required')
16
- }
17
-
18
- if (!user.domains?.find(d => d.subdomain === subdomain) && !process.superUserGranted(domain, user)) {
19
- throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`)
20
- }
21
-
22
- return pipe(
23
- pubsub.subscribe('play-group'),
24
- filter((payload: { playGroup: PlayGroup }) => {
25
- const { id: playGroupId, domainId } = payload.playGroup
26
-
27
- if (domainId !== domain.id) {
28
- return false
29
- }
30
-
31
- if (id !== playGroupId) {
32
- return false
33
- }
34
-
35
- return true
36
- })
37
- )
38
- }
39
- })
40
- playGroup(@Root() payload: { playGroup: PlayGroup }, @Arg('id') id: string): PlayGroup {
41
- return payload.playGroup
42
- }
43
- }
@@ -1,30 +0,0 @@
1
- import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
2
-
3
- import { PlayGroup } from './play-group'
4
-
5
- @InputType()
6
- export class NewPlayGroup {
7
- @Field()
8
- name: string
9
-
10
- @Field({ nullable: true })
11
- description?: string
12
- }
13
-
14
- @InputType()
15
- export class PlayGroupPatch {
16
- @Field({ nullable: true })
17
- name: string
18
-
19
- @Field({ nullable: true })
20
- description?: string
21
- }
22
-
23
- @ObjectType()
24
- export class PlayGroupList {
25
- @Field(type => [PlayGroup])
26
- items: PlayGroup[]
27
-
28
- @Field(type => Int)
29
- total: number
30
- }
@@ -1,74 +0,0 @@
1
- import { Field, ID, ObjectType } from 'type-graphql'
2
- import {
3
- Column,
4
- CreateDateColumn,
5
- Entity,
6
- Index,
7
- JoinTable,
8
- ManyToMany,
9
- ManyToOne,
10
- PrimaryGeneratedColumn,
11
- RelationId,
12
- UpdateDateColumn
13
- } from 'typeorm'
14
-
15
- import { User } from '@things-factory/auth-base'
16
- import { Domain } from '@things-factory/shell'
17
-
18
- import { Board } from '../board/board'
19
-
20
- @Entity()
21
- @Index('ix_play_group_0', (playGroup: PlayGroup) => [playGroup.domain, playGroup.name], { unique: true })
22
- @ObjectType({ description: 'Entity for Board PlayGroup' })
23
- export class PlayGroup {
24
- @PrimaryGeneratedColumn('uuid')
25
- @Field(type => ID)
26
- readonly id: string
27
-
28
- @ManyToOne(type => Domain)
29
- @Field(type => Domain, { nullable: true })
30
- domain?: Domain
31
-
32
- @RelationId((playGroup: PlayGroup) => playGroup.domain)
33
- domainId?: string
34
-
35
- @Column()
36
- @Field()
37
- name: string
38
-
39
- @Column({
40
- nullable: true
41
- })
42
- @Field({ nullable: true })
43
- description?: string
44
-
45
- @ManyToMany(type => Board, board => board.playGroups)
46
- @JoinTable({ name: 'play_groups_boards' })
47
- @Field(type => [Board], { nullable: true })
48
- boards: Board[]
49
-
50
- @Column('simple-json', { nullable: true })
51
- order: any
52
-
53
- @CreateDateColumn()
54
- @Field({ nullable: true })
55
- createdAt?: Date
56
-
57
- @UpdateDateColumn()
58
- @Field({ nullable: true })
59
- updatedAt?: Date
60
-
61
- @ManyToOne(type => User, { nullable: true })
62
- @Field(type => User, { nullable: true })
63
- creator?: User
64
-
65
- @RelationId((playGroup: PlayGroup) => playGroup.creator)
66
- creatorId?: string
67
-
68
- @ManyToOne(type => User, { nullable: true })
69
- @Field(type => User, { nullable: true })
70
- updater?: User
71
-
72
- @RelationId((playGroup: PlayGroup) => playGroup.updater)
73
- updaterId?: string
74
- }
@@ -1,7 +0,0 @@
1
- import { Theme } from './theme'
2
- import { ThemeQuery } from './theme-query'
3
- import { ThemeMutation } from './theme-mutation'
4
-
5
- export const entities = [Theme]
6
- export const resolvers = [ThemeQuery, ThemeMutation]
7
- export const subscribers = []
@@ -1,128 +0,0 @@
1
- import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
- import { In } from 'typeorm'
3
-
4
- import { Theme } from './theme'
5
- import { NewTheme, ThemePatch } from './theme-type'
6
-
7
- @Resolver(Theme)
8
- export class ThemeMutation {
9
- @Directive('@transaction')
10
- @Mutation(returns => Theme, { description: 'To create new Theme' })
11
- async createTheme(@Arg('theme') theme: NewTheme, @Ctx() context: ResolverContext): Promise<Theme> {
12
- const { domain, user, tx } = context.state
13
-
14
- return await tx.getRepository(Theme).save({
15
- ...theme,
16
- domain,
17
- creator: user,
18
- updater: user
19
- })
20
- }
21
-
22
- @Directive('@transaction')
23
- @Mutation(returns => Theme, { description: 'To modify Theme information' })
24
- async updateTheme(
25
- @Arg('id') id: string,
26
- @Arg('patch') patch: ThemePatch,
27
- @Ctx() context: ResolverContext
28
- ): Promise<Theme> {
29
- const { domain, user, tx } = context.state
30
-
31
- const repository = tx.getRepository(Theme)
32
- const theme = await repository.findOne({
33
- where: { domain: { id: domain.id }, id }
34
- })
35
-
36
- return await repository.save({
37
- ...theme,
38
- ...patch,
39
- updater: user
40
- })
41
- }
42
-
43
- @Directive('@transaction')
44
- @Mutation(returns => [Theme], { description: "To modify multiple Themes' information" })
45
- async updateMultipleTheme(
46
- @Arg('patches', type => [ThemePatch]) patches: ThemePatch[],
47
- @Ctx() context: ResolverContext
48
- ): Promise<Theme[]> {
49
- const { domain, user, tx } = context.state
50
-
51
- let results = []
52
- const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
53
- const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
54
- const themeRepo = tx.getRepository(Theme)
55
-
56
- if (_createRecords.length > 0) {
57
- for (let i = 0; i < _createRecords.length; i++) {
58
- const newRecord = _createRecords[i]
59
-
60
- const result = await themeRepo.save({
61
- ...newRecord,
62
- domain,
63
- creator: user,
64
- updater: user
65
- })
66
-
67
- results.push({ ...result, cuFlag: '+' })
68
- }
69
- }
70
-
71
- if (_updateRecords.length > 0) {
72
- for (let i = 0; i < _updateRecords.length; i++) {
73
- const updateRecord = _updateRecords[i]
74
- const theme = await themeRepo.findOneBy({ id: updateRecord.id })
75
-
76
- const result = await themeRepo.save({
77
- ...theme,
78
- ...updateRecord,
79
- updater: user
80
- })
81
-
82
- results.push({ ...result, cuFlag: 'M' })
83
- }
84
- }
85
-
86
- return results
87
- }
88
-
89
- @Directive('@transaction')
90
- @Mutation(returns => Boolean, { description: 'To delete Theme' })
91
- async deleteTheme(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
92
- const { domain, tx } = context.state
93
-
94
- await tx.getRepository(Theme).delete({ domain: { id: domain.id }, id })
95
-
96
- return true
97
- }
98
-
99
- @Directive('@transaction')
100
- @Mutation(returns => Boolean, { description: 'To delete multiple Themes' })
101
- async deleteThemes(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
102
- const { domain, tx } = context.state
103
-
104
- await tx.getRepository(Theme).delete({
105
- domain: { id: domain.id },
106
- id: In(ids)
107
- })
108
-
109
- return true
110
- }
111
-
112
- @Directive('@transaction')
113
- @Mutation(returns => Boolean, { description: 'To import multiple Themes' })
114
- async importThemes(
115
- @Arg('themes', type => [ThemePatch]) themes: ThemePatch[],
116
- @Ctx() context: ResolverContext
117
- ): Promise<boolean> {
118
- const { domain, tx } = context.state
119
-
120
- await Promise.all(
121
- themes.map(async (theme: ThemePatch) => {
122
- const createdTheme: Theme = await tx.getRepository(Theme).save({ domain, ...theme })
123
- })
124
- )
125
-
126
- return true
127
- }
128
- }
@@ -1,48 +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 { Theme } from './theme'
5
- import { ThemeList } from './theme-type'
6
-
7
- @Resolver(Theme)
8
- export class ThemeQuery {
9
- @Query(returns => Theme!, { nullable: true, description: 'To fetch a Theme' })
10
- async theme(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Theme> {
11
- const { domain } = context.state
12
-
13
- return await getRepository(Theme).findOne({
14
- where: { domain: { id: domain.id }, id }
15
- })
16
- }
17
-
18
- @Query(returns => ThemeList, { description: 'To fetch multiple Themes' })
19
- async themes(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<ThemeList> {
20
- const { domain } = context.state
21
-
22
- const queryBuilder = getQueryBuilderFromListParams({
23
- domain,
24
- params,
25
- repository: await getRepository(Theme),
26
- searchables: ['name', 'description']
27
- })
28
-
29
- const [items, total] = await queryBuilder.getManyAndCount()
30
-
31
- return { items, total }
32
- }
33
-
34
- @FieldResolver(type => Domain)
35
- async domain(@Root() theme: Theme): Promise<Domain> {
36
- return theme.domainId && (await getRepository(Domain).findOneBy({ id: theme.domainId }))
37
- }
38
-
39
- @FieldResolver(type => User)
40
- async updater(@Root() theme: Theme): Promise<User> {
41
- return theme.updaterId && (await getRepository(User).findOneBy({ id: theme.updaterId }))
42
- }
43
-
44
- @FieldResolver(type => User)
45
- async creator(@Root() theme: Theme): Promise<User> {
46
- return theme.creatorId && (await getRepository(User).findOneBy({ id: theme.creatorId }))
47
- }
48
- }
@@ -1,55 +0,0 @@
1
- import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
2
-
3
- import { ScalarObject } from '@things-factory/shell'
4
- import { Theme } from './theme'
5
-
6
- @InputType()
7
- export class NewTheme {
8
- @Field()
9
- name: string
10
-
11
- @Field({ nullable: true })
12
- description?: string
13
-
14
- @Field({ nullable: true })
15
- active?: boolean
16
-
17
- @Field({ nullable: true })
18
- type?: string
19
-
20
- @Field(type => ScalarObject, { nullable: true })
21
- value?: any
22
- }
23
-
24
- @InputType()
25
- export class ThemePatch {
26
- @Field(type => ID, { nullable: true })
27
- id?: string
28
-
29
- @Field({ nullable: true })
30
- name?: string
31
-
32
- @Field({ nullable: true })
33
- description?: string
34
-
35
- @Field({ nullable: true })
36
- active?: boolean
37
-
38
- @Field({ nullable: true })
39
- type?: string
40
-
41
- @Field(type => ScalarObject, { nullable: true })
42
- value?: any
43
-
44
- @Field({ nullable: true })
45
- cuFlag?: string
46
- }
47
-
48
- @ObjectType()
49
- export class ThemeList {
50
- @Field(type => [Theme])
51
- items: Theme[]
52
-
53
- @Field(type => Int)
54
- total: number
55
- }
@@ -1,97 +0,0 @@
1
- import {
2
- CreateDateColumn,
3
- UpdateDateColumn,
4
- DeleteDateColumn,
5
- Entity,
6
- Index,
7
- Column,
8
- RelationId,
9
- ManyToOne,
10
- PrimaryGeneratedColumn
11
- } from 'typeorm'
12
- import { ObjectType, Field, ID } from 'type-graphql'
13
-
14
- import { Domain, ScalarObject } from '@things-factory/shell'
15
- import { User } from '@things-factory/auth-base'
16
-
17
- export interface ThemeType {
18
- name: string
19
- propType: string
20
- }
21
-
22
- var ThemeTypes: { [name: string]: ThemeType } = {
23
- Legend: {
24
- name: 'Legend',
25
- propType: 'legend'
26
- }
27
- }
28
-
29
- @Entity()
30
- @Index('ix_theme_0', (theme: Theme) => [theme.domain, theme.name, theme.deletedAt], { unique: true })
31
- @ObjectType({ description: 'Entity for Theme' })
32
- export class Theme {
33
- static registerThemeType(themeType: ThemeType) {
34
- ThemeTypes[themeType.name] = themeType
35
- }
36
-
37
- static getThemeType(name: string) {
38
- return ThemeTypes[name]
39
- }
40
-
41
- @PrimaryGeneratedColumn('uuid')
42
- @Field(type => ID)
43
- readonly id: string
44
-
45
- @ManyToOne(type => Domain)
46
- @Field(type => Domain)
47
- domain?: Domain
48
-
49
- @RelationId((theme: Theme) => theme.domain)
50
- domainId?: string
51
-
52
- @Column()
53
- @Field({ nullable: true })
54
- name?: string
55
-
56
- @Column({ nullable: true })
57
- @Field({ nullable: true })
58
- description?: string
59
-
60
- @Column({ nullable: true })
61
- @Field({ nullable: true })
62
- active: boolean
63
-
64
- @Column({ nullable: true })
65
- @Field({ nullable: true })
66
- type?: string
67
-
68
- @Column('simple-json', { nullable: true })
69
- @Field(type => ScalarObject, { nullable: true })
70
- value?: any
71
-
72
- @CreateDateColumn()
73
- @Field({ nullable: true })
74
- createdAt?: Date
75
-
76
- @UpdateDateColumn()
77
- @Field({ nullable: true })
78
- updatedAt?: Date
79
-
80
- @DeleteDateColumn()
81
- @Field({ nullable: true })
82
- deletedAt?: Date
83
-
84
- @ManyToOne(type => User, { nullable: true })
85
- @Field(type => User, { nullable: true })
86
- creator?: User
87
-
88
- @RelationId((theme: Theme) => theme.creator)
89
- creatorId?: string
90
-
91
- @ManyToOne(type => User, { nullable: true })
92
- @Field(type => User, { nullable: true })
93
- updater?: User
94
-
95
- @RelationId((theme: Theme) => theme.updater)
96
- updaterId?: string
97
- }