Skip to content

Commit

Permalink
Merge pull request #231 from tnc-ca-geo/feature/typescript/add-_id-to…
Browse files Browse the repository at this point in the history
…-subdocuments

FIX: Add _id property on subdocuments
  • Loading branch information
nathanielrindlaub authored Jul 16, 2024
2 parents 9a90730 + afbf193 commit 9963189
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/db/schemas/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ const FiltersSchema = new Schema({
});

const ViewSchema = new Schema({
_id: { type: Schema.Types.ObjectId, required: true },
name: { type: String, required: true },
filters: { type: FiltersSchema, required: true },
description: { type: String },
editable: { type: Boolean },
});

const DeploymentSchema = new Schema({
_id: { type: Schema.Types.ObjectId, required: true },
name: { type: String, required: true },
description: { type: String },
location: { type: LocationSchema },
Expand Down
1 change: 1 addition & 0 deletions src/api/db/schemas/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import MongoPaging from 'mongo-cursor-pagination';
const Schema = mongoose.Schema;

const TaskSchema = new Schema({
_id: { type: Schema.Types.ObjectId, required: true },
user: { type: String, required: true },
projectId: { type: String, required: true, ref: 'Project' },
type: {
Expand Down
3 changes: 3 additions & 0 deletions src/api/db/schemas/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const PointSchema = new Schema({
});

const LocationSchema = new Schema({
_id: { type: Schema.Types.ObjectId, required: true },
geometry: { type: PointSchema, required: true },
altitude: { type: String },
name: { type: String },
Expand All @@ -32,6 +33,7 @@ const ValidationSchema = new Schema({
*/

const LabelSchema = new Schema({
_id: { type: mongoose.Schema.Types.ObjectId, required: true },
type: { type: String, enum: ['manual', 'ml', 'default'], required: true, default: 'manual' },
labelId: { type: String, required: true },
conf: { type: Number },
Expand All @@ -53,6 +55,7 @@ const LabelSchema = new Schema({
*/

const ObjectSchema = new Schema({
_id: { type: Schema.Types.ObjectId, required: true },
bbox: { type: [Number], required: true },
locked: { type: Boolean, default: false, required: true },
labels: { type: [LabelSchema] },
Expand Down

0 comments on commit 9963189

Please sign in to comment.