@things-factory/calendar 6.0.53 → 6.0.57

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/calendar",
3
- "version": "6.0.53",
3
+ "version": "6.0.57",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -29,8 +29,8 @@
29
29
  "@operato/event-view": "1.2.5",
30
30
  "@operato/graphql": "^1.0.0",
31
31
  "@operato/shell": "^1.0.0",
32
- "@things-factory/auth-base": "^6.0.53",
33
- "@things-factory/shell": "^6.0.49"
32
+ "@things-factory/auth-base": "^6.0.57",
33
+ "@things-factory/shell": "^6.0.57"
34
34
  },
35
- "gitHead": "1b60f52b7e043286423881b8fb41f1fa08f9ba6d"
35
+ "gitHead": "7aaa2253e3046278972372263d13fd9b6dbb6e8b"
36
36
  }
@@ -1,8 +1,6 @@
1
1
  import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
2
  import { In } from 'typeorm'
3
3
 
4
- import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
5
-
6
4
  import { Calendar } from './calendar'
7
5
  import { NewCalendar, CalendarPatch } from './calendar-type'
8
6
 
@@ -20,20 +18,6 @@ export class CalendarMutation {
20
18
  updater: user
21
19
  })
22
20
 
23
- if (calendar.thumbnail) {
24
- await createAttachment(
25
- null,
26
- {
27
- attachment: {
28
- file: calendar.thumbnail,
29
- refType: Calendar.name,
30
- refBy: result.id
31
- }
32
- },
33
- context
34
- )
35
- }
36
-
37
21
  return result
38
22
  }
39
23
 
@@ -51,28 +35,11 @@ export class CalendarMutation {
51
35
  where: { domain: { id: domain.id }, id }
52
36
  })
53
37
 
54
- const result = await repository.save({
38
+ return await repository.save({
55
39
  ...calendar,
56
40
  ...patch,
57
41
  updater: user
58
42
  })
59
-
60
- if (patch.thumbnail) {
61
- await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)
62
- await createAttachment(
63
- null,
64
- {
65
- attachment: {
66
- file: patch.thumbnail,
67
- refType: Calendar.name,
68
- refBy: result.id
69
- }
70
- },
71
- context
72
- )
73
- }
74
-
75
- return result
76
43
  }
77
44
 
78
45
  @Directive('@transaction')
@@ -99,20 +66,6 @@ export class CalendarMutation {
99
66
  updater: user
100
67
  })
101
68
 
102
- if (newRecord.thumbnail) {
103
- await createAttachment(
104
- null,
105
- {
106
- attachment: {
107
- file: newRecord.thumbnail,
108
- refType: Calendar.name,
109
- refBy: result.id
110
- }
111
- },
112
- context
113
- )
114
- }
115
-
116
69
  results.push({ ...result, cuFlag: '+' })
117
70
  }
118
71
  }
@@ -128,21 +81,6 @@ export class CalendarMutation {
128
81
  updater: user
129
82
  })
130
83
 
131
- if (updateRecord.thumbnail) {
132
- await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)
133
- await createAttachment(
134
- null,
135
- {
136
- attachment: {
137
- file: updateRecord.thumbnail,
138
- refType: Calendar.name,
139
- refBy: result.id
140
- }
141
- },
142
- context
143
- )
144
- }
145
-
146
84
  results.push({ ...result, cuFlag: 'M' })
147
85
  }
148
86
  }
@@ -156,7 +94,6 @@ export class CalendarMutation {
156
94
  const { domain, tx } = context.state
157
95
 
158
96
  await tx.getRepository(Calendar).delete({ domain: { id: domain.id }, id })
159
- await deleteAttachmentsByRef(null, { refBys: [id] }, context)
160
97
 
161
98
  return true
162
99
  }
@@ -174,8 +111,6 @@ export class CalendarMutation {
174
111
  id: In(ids)
175
112
  })
176
113
 
177
- await deleteAttachmentsByRef(null, { refBys: ids }, context)
178
-
179
114
  return true
180
115
  }
181
116
 
@@ -1,5 +1,4 @@
1
1
  import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
2
- import { Attachment } from '@things-factory/attachment-base'
3
2
  import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
4
3
  import { User } from '@things-factory/auth-base'
5
4
  import { Calendar } from './calendar'
@@ -32,19 +31,6 @@ export class CalendarQuery {
32
31
  return { items, total }
33
32
  }
34
33
 
35
- @FieldResolver(type => String)
36
- async thumbnail(@Root() calendar: Calendar): Promise<string | undefined> {
37
- const attachment: Attachment = await getRepository(Attachment).findOne({
38
- where: {
39
- domain: { id: calendar.domainId },
40
- refType: Calendar.name,
41
- refBy: calendar.id
42
- }
43
- })
44
-
45
- return attachment?.fullpath
46
- }
47
-
48
34
  @FieldResolver(type => Domain)
49
35
  async domain(@Root() calendar: Calendar): Promise<Domain> {
50
36
  return await getRepository(Domain).findOneBy({ id: calendar.domainId })
@@ -22,9 +22,6 @@ export class NewCalendar {
22
22
 
23
23
  @Field({ nullable: true })
24
24
  params?: string
25
-
26
- @Field(type => GraphQLUpload, { nullable: true })
27
- thumbnail?: FileUpload
28
25
  }
29
26
 
30
27
  @InputType()
@@ -44,9 +41,6 @@ export class CalendarPatch {
44
41
  @Field({ nullable: true })
45
42
  active?: boolean
46
43
 
47
- @Field(type => GraphQLUpload, { nullable: true })
48
- thumbnail?: FileUpload
49
-
50
44
  @Field({ nullable: true })
51
45
  cuFlag?: string
52
46
  }