36 lines
627 B
TypeScript
36 lines
627 B
TypeScript
import { JSONContent } from '@tiptap/core'
|
|
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
|
|
description?: string | JSONContent
|
|
}
|
|
|
|
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
|