manifold/common/answer.ts
2022-05-06 14:29:15 -04:00

34 lines
547 B
TypeScript

import { User } from './user'
export type Answer = {
id: string
number: number
contractId: string
createdTime: number
userId: string
username: string
name: string
avatarUrl?: string
text: string
}
export const getNoneAnswer = (contractId: string, creator: User) => {
const { username, name, avatarUrl } = creator
return {
id: '0',
number: 0,
contractId,
createdTime: Date.now(),
userId: creator.id,
username,
name,
avatarUrl,
text: 'None',
}
}
export const MAX_ANSWER_LENGTH = 240