do feed
This commit is contained in:
parent
2586dc87c8
commit
e84cf232a5
13 changed files with 605 additions and 139 deletions
20
src/model/posts/posts.ts
Normal file
20
src/model/posts/posts.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { Temporal } from '@js-temporal/polyfill'
|
||||
import { components } from '../../api/schema.ts'
|
||||
|
||||
export class Post {
|
||||
public readonly postId: string
|
||||
public readonly content: string
|
||||
public readonly media: string[]
|
||||
public readonly createdAt: Temporal.PlainDateTime
|
||||
|
||||
constructor(postId: string, content: string, media: string[], createdAt: Temporal.PlainDateTime) {
|
||||
this.postId = postId
|
||||
this.content = content
|
||||
this.media = media
|
||||
this.createdAt = createdAt
|
||||
}
|
||||
|
||||
public static fromDto(dto: components['schemas']['AuthorPostDto']): Post {
|
||||
return new Post(dto.postId, dto.content, dto.media, Temporal.PlainDateTime.from(dto.createdAt))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue