mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import { Field, Int, ObjectType } from 'type-graphql'
|
|
import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage'
|
|
import { User } from '@entity/User'
|
|
|
|
@ObjectType()
|
|
export class ContributionMessage {
|
|
constructor(contributionMessage: DbContributionMessage, user: User) {
|
|
this.id = contributionMessage.id
|
|
this.message = contributionMessage.message
|
|
this.createdAt = contributionMessage.createdAt
|
|
this.updatedAt = contributionMessage.updatedAt
|
|
this.type = contributionMessage.type
|
|
this.userFirstName = user.firstName
|
|
this.userLastName = user.lastName
|
|
this.userId = user.id
|
|
this.isModerator = contributionMessage.isModerator
|
|
}
|
|
|
|
@Field(() => Int)
|
|
id: number
|
|
|
|
@Field(() => String)
|
|
message: string
|
|
|
|
@Field(() => Date)
|
|
createdAt: Date
|
|
|
|
@Field(() => Date, { nullable: true })
|
|
updatedAt: Date | null
|
|
|
|
@Field(() => String)
|
|
type: string
|
|
|
|
@Field(() => String, { nullable: true })
|
|
userFirstName: string | null
|
|
|
|
@Field(() => String, { nullable: true })
|
|
userLastName: string | null
|
|
|
|
@Field(() => Int, { nullable: true })
|
|
userId: number | null
|
|
|
|
@Field(() => Boolean)
|
|
isModerator: boolean
|
|
}
|
|
@ObjectType()
|
|
export class ContributionMessageListResult {
|
|
@Field(() => Int)
|
|
count: number
|
|
|
|
@Field(() => [ContributionMessage])
|
|
messages: ContributionMessage[]
|
|
}
|