@meith/attachments 0.31.0 → 0.33.0

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 (2) hide show
  1. package/package.json +3 -3
  2. package/src/service.ts +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meith/attachments",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,7 +24,7 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@meith/core": "0.31.0",
28
- "@meith/i18n": "0.31.0"
27
+ "@meith/core": "0.33.0",
28
+ "@meith/i18n": "0.33.0"
29
29
  }
30
30
  }
package/src/service.ts CHANGED
@@ -144,6 +144,7 @@ export interface AttachmentRepository {
144
144
  stalled(before: Date, limit: number): Promise<readonly AttachmentRecord[]>
145
145
 
146
146
  attachTo(id: number, postId: number): Promise<AttachmentRecord | null>
147
+ deleteForPost(id: number, postId: number): Promise<AttachmentRecord | null>
147
148
  deleteOrphans(before: Date, limit: number): Promise<readonly AttachmentRecord[]>
148
149
 
149
150
  rememberKey(key: string): Promise<void>
@@ -263,6 +264,10 @@ export class AttachmentService {
263
264
  return claimed
264
265
  }
265
266
 
267
+ async removeFromPost(id: number, postId: number): Promise<AttachmentRecord | null> {
268
+ return this.deps.attachments.deleteForPost(id, postId)
269
+ }
270
+
266
271
  async process(attachmentId: number): Promise<'done' | 'skipped' | 'failed'> {
267
272
  const record = await this.deps.attachments.findById(attachmentId)
268
273
  if (record === null || record.status !== 'pending' || record.sourceKey === null) {