Skip to content

Commit

Permalink
introduce attachment interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ghackenberg committed Nov 25, 2023
1 parent c6446a5 commit 53a34f9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/common/src/data/attachment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { ApiProperty } from '@nestjs/swagger'

export class AttachmentUpdateData {
@ApiProperty()
name: string
@ApiProperty()
type: string
}

export class AttachmentAddData extends AttachmentUpdateData {

}

export class Attachment extends AttachmentAddData {
@ApiProperty()
productId: string
@ApiProperty()
issueId: string
@ApiProperty()
commentId: string
@ApiProperty()
attachmentId: string

@ApiProperty()
created: number
@ApiProperty()
updated: number
@ApiProperty()
deleted: number
}
9 changes: 9 additions & 0 deletions packages/common/src/rest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { JWK } from 'jose'

import { Attachment } from './data/attachment'
import { Comment, CommentAddData, CommentUpdateData } from './data/comment'
import { Issue, IssueAddData, IssueUpdateData } from './data/issue'
import { Member, MemberAddData, MemberUpdateData } from './data/member'
Expand Down Expand Up @@ -58,6 +59,14 @@ export interface CommentREST {
deleteComment(productId: string, issueId: string, commentId: string): Promise<Comment>
}

export interface AttachmentREST<AA, AU, F> {
findAttachments(productId: string, issueId: string, commentId: string): Promise<Attachment[]>
addAttachment(productId: string, issueId: string, commentId: string, data: AA, file: F): Promise<Attachment>
getAttachment(productId: string, issueId: string, commentId: string, attachmentId: string): Promise<Attachment>
updateAttachment(productId: string, issueId: string, commentId: string, attachmentId: string, data: AU, file?: F): Promise<Attachment>
deleteAttachment(productId: string, issueId: string, commentId: string, attachmentId: string): Promise<Attachment>
}

export interface MilestoneREST {
findMilestones(productId: string): Promise<Milestone[]>
addMilestone(productId: string, data: MilestoneAddData): Promise<Milestone>
Expand Down

0 comments on commit 53a34f9

Please sign in to comment.