recatfor
This commit is contained in:
parent
8e365867bd
commit
74c66e74c9
13 changed files with 363 additions and 112 deletions
|
@ -4,21 +4,21 @@ 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
|
||||
public readonly media: URL[]
|
||||
public readonly createdAt: Temporal.Instant
|
||||
public readonly authorName: string
|
||||
|
||||
constructor(
|
||||
postId: string,
|
||||
content: string,
|
||||
media: string[],
|
||||
createdAt: Temporal.PlainDateTime,
|
||||
media: URL[],
|
||||
createdAt: string | Temporal.Instant,
|
||||
authorName: string,
|
||||
) {
|
||||
this.postId = postId
|
||||
this.content = content
|
||||
this.media = media
|
||||
this.createdAt = createdAt
|
||||
this.createdAt = Temporal.Instant.from(createdAt)
|
||||
this.authorName = authorName
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,8 @@ export class Post {
|
|||
return new Post(
|
||||
dto.postId,
|
||||
dto.content,
|
||||
dto.media,
|
||||
Temporal.PlainDateTime.from(dto.createdAt),
|
||||
dto.media.map((url) => new URL(url)),
|
||||
Temporal.Instant.from(dto.createdAt),
|
||||
dto.author.username,
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue