Skip to content

Commit

Permalink
Reference File schema from Assembly schema
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens committed Aug 30, 2024
1 parent 3e74827 commit a2f089c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/apollo-schemas/src/assembly.schema.ts
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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)

0 comments on commit a2f089c

Please sign in to comment.