@things-factory/attachment-base 6.0.0-zeta.8 → 6.0.1
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/attachment-base",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"@aws-sdk/lib-storage": "^3.46.0",
|
|
28
28
|
"@aws-sdk/s3-presigned-post": "^3.46.0",
|
|
29
29
|
"@koa/multer": "^3.0.0",
|
|
30
|
-
"@things-factory/auth-base": "^6.0.
|
|
31
|
-
"@things-factory/env": "^6.0.
|
|
32
|
-
"@things-factory/shell": "^6.0.
|
|
30
|
+
"@things-factory/auth-base": "^6.0.1",
|
|
31
|
+
"@things-factory/env": "^6.0.1",
|
|
32
|
+
"@things-factory/shell": "^6.0.1",
|
|
33
33
|
"memfs": "^3.0.1",
|
|
34
34
|
"mime": "^2.4.4",
|
|
35
35
|
"multer": "^1.4.5-lts.1"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "e5fe832cd3b1ac14b80d5bc9be2a2e650ab31d51"
|
|
38
38
|
}
|
|
@@ -100,9 +100,11 @@ export async function createAttachment(_: any, { attachment }, context: Resolver
|
|
|
100
100
|
const stream = createReadStream()
|
|
101
101
|
|
|
102
102
|
const { id, path, size } = await STORAGE.uploadFile({ stream, filename })
|
|
103
|
-
const { domain, user } = context.state
|
|
103
|
+
const { domain, user, tx } = context.state
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
const repository = tx ? tx.getRepository(Attachment) : getRepository(Attachment)
|
|
106
|
+
|
|
107
|
+
return await repository.save({
|
|
106
108
|
domain,
|
|
107
109
|
creator: user,
|
|
108
110
|
updater: user,
|
|
@@ -134,9 +136,9 @@ export async function createAttachments(_: any, { attachments }, context: Resolv
|
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
export async function deleteAttachment(_: any, { id }, context: ResolverContext): Promise<boolean> {
|
|
137
|
-
const { domain } = context.state
|
|
139
|
+
const { domain, tx } = context.state
|
|
138
140
|
|
|
139
|
-
const repository = getRepository(Attachment)
|
|
141
|
+
const repository = tx ? tx.getRepository(Attachment) : getRepository(Attachment)
|
|
140
142
|
const attachment = await repository.findOne({
|
|
141
143
|
where: { domain: { id: domain.id }, id }
|
|
142
144
|
})
|
|
@@ -151,9 +153,9 @@ export async function deleteAttachment(_: any, { id }, context: ResolverContext)
|
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
export async function deleteAttachmentsByRef(_: any, { refBys }, context: ResolverContext): Promise<boolean> {
|
|
154
|
-
const { domain } = context.state
|
|
156
|
+
const { domain, tx } = context.state
|
|
155
157
|
|
|
156
|
-
const repository = getRepository(Attachment)
|
|
158
|
+
const repository = tx ? tx.getRepository(Attachment) : getRepository(Attachment)
|
|
157
159
|
const attachments = await repository.find({
|
|
158
160
|
where: { domain: { id: domain.id }, refBy: In(refBys) }
|
|
159
161
|
})
|