diff --git a/packages/apollo-schemas/src/assembly.schema.ts b/packages/apollo-schemas/src/assembly.schema.ts index 4a4693d8..728d8d8b 100644 --- a/packages/apollo-schemas/src/assembly.schema.ts +++ b/packages/apollo-schemas/src/assembly.schema.ts @@ -1,6 +1,8 @@ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose' import { Schema as MongooseSchema, Types } from 'mongoose' +import { File } from './file.schema' + export type AssemblyDocument = Assembly & Document @Schema() @@ -26,14 +28,20 @@ export class Assembly { @Prop({ type: { fa: String, fai: String, gzi: String } }) externalLocation: { fa: string; fai: string; gzi?: string } - @Prop({ type: { fa: String, fai: String, gzi: String } }) - fileIds: { fa: string; fai: string; gzi?: string } // Store fileId of fa/fai/gzi. + @Prop({ + type: { + fa: { type: MongooseSchema.Types.ObjectId, ref: 'File' }, + fai: { type: MongooseSchema.Types.ObjectId, ref: 'File' }, + gzi: { type: MongooseSchema.Types.ObjectId, ref: 'File' }, + }, + }) + fileIds: { fa: string; fai: string; gzi: string } // Store fileId of fa/fai/gzi. @Prop({ type: [{ type: MongooseSchema.Types.ObjectId, ref: 'Check' }] }) checks: Types.ObjectId[] - @Prop() - fileId: string + @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'File' }) + file: File } export const AssemblySchema = SchemaFactory.createForClass(Assembly)