forked from Chatbot/v3-api
78 lines
1.6 KiB
TypeScript
78 lines
1.6 KiB
TypeScript
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
import { QuestionsModel } from './questions.model';
|
|
|
|
export interface UpdatedBy {
|
|
name: string; // User's mobile number
|
|
updatedAt: {
|
|
time: string; // Time of update
|
|
date: string; // Date of update
|
|
};
|
|
}
|
|
|
|
@Schema({
|
|
timestamps: false,
|
|
versionKey: false,
|
|
collection: 'dictionaries',
|
|
_id: true,
|
|
})
|
|
export class DictionariesModel {
|
|
@Prop({ type: String })
|
|
title: string;
|
|
|
|
@Prop({ type: 'string' })
|
|
category: string;
|
|
|
|
@Prop({ type: String })
|
|
type: 'Regulation' | 'Method';
|
|
|
|
@Prop()
|
|
questions: QuestionsModel[];
|
|
|
|
@Prop({ type: Boolean })
|
|
isActive: boolean;
|
|
|
|
@Prop({ type: [String] })
|
|
fileId: string[];
|
|
|
|
@Prop({ type: String })
|
|
icon: string;
|
|
|
|
@Prop({ type: String, required: false })
|
|
aiCollectionId: string;
|
|
|
|
@Prop({ type: String, required: false })
|
|
aiCollectionName: string;
|
|
|
|
/** Cached from AI get-collections-with-descriptions / get-collection-description. */
|
|
@Prop({ type: String, required: false })
|
|
description?: string;
|
|
|
|
@Prop({ type: [String], default: [] })
|
|
keywords?: string[];
|
|
|
|
/**
|
|
* Sync bookkeeping vs AI SoT.
|
|
* ok | missing | deactivated | stale
|
|
*/
|
|
@Prop({ type: String, required: false, default: 'ok' })
|
|
aiSyncStatus?: string;
|
|
|
|
@Prop({ type: Date, required: false })
|
|
lastSyncedAt?: Date;
|
|
|
|
@Prop({ type: Array })
|
|
createdAt: [];
|
|
|
|
@Prop({ type: Date })
|
|
createdISO: Date;
|
|
|
|
@Prop({ type: Date })
|
|
updatedAt: Date;
|
|
|
|
@Prop({ type: [Object] })
|
|
updatedBy: UpdatedBy[];
|
|
}
|
|
|
|
export const DictionariesSchema =
|
|
SchemaFactory.createForClass(DictionariesModel);
|