Spaces:
Build error
Build error
| import { Also, Prop, parseJSONText } from 'civkit'; | |
| import { FirestoreRecord } from '../shared/lib/firestore'; | |
| import _ from 'lodash'; | |
| ({ | |
| dictOf: Object | |
| }) | |
| export class PDFContent extends FirestoreRecord { | |
| static override collectionName = 'pdfs'; | |
| override _id!: string; | |
| ({ | |
| required: true | |
| }) | |
| src!: string; | |
| ({ | |
| required: true | |
| }) | |
| urlDigest!: string; | |
| () | |
| meta?: { [k: string]: any; }; | |
| () | |
| text?: string; | |
| () | |
| content?: string; | |
| () | |
| createdAt!: Date; | |
| () | |
| expireAt?: Date; | |
| static patchedFields = [ | |
| 'meta' | |
| ]; | |
| static override from(input: any) { | |
| for (const field of this.patchedFields) { | |
| if (typeof input[field] === 'string') { | |
| input[field] = parseJSONText(input[field]); | |
| } | |
| } | |
| return super.from(input) as PDFContent; | |
| } | |
| override degradeForFireStore() { | |
| const copy: any = { ...this }; | |
| for (const field of (this.constructor as typeof PDFContent).patchedFields) { | |
| if (typeof copy[field] === 'object') { | |
| copy[field] = JSON.stringify(copy[field]) as any; | |
| } | |
| } | |
| return copy; | |
| } | |
| [k: string]: any; | |
| } | |