diff --git a/service/src/entities/observations/entities.observations.ts b/service/src/entities/observations/entities.observations.ts index 505a89a99..dcadbba4e 100644 --- a/service/src/entities/observations/entities.observations.ts +++ b/service/src/entities/observations/entities.observations.ts @@ -71,7 +71,7 @@ export interface ObservationImportantFlag { export interface ObservationState { id: string | PendingEntityId - name: 'active' | 'archived' + name: 'active' | 'archive' userId?: UserId | undefined /** * @deprecated TODO: confine URLs to the web layer @@ -668,7 +668,7 @@ export function removeFormEntry(observation: Observation, formEntryId: FormEntry return Observation.assignTo(observation, mod) as Observation } -export type AttachmentCreateAttrs = Omit +export type AttachmentCreateAttrs = Omit export type AttachmentPatchAttrs = Partial export type AttachmentContentPatchAttrs = Required> export type ThumbnailContentPatchAttrs = Required> & Thumbnail diff --git a/service/test/adapters/observations/adapters.observations.db.mongoose.test.ts b/service/test/adapters/observations/adapters.observations.db.mongoose.test.ts index 6ccdd8558..091ccf479 100644 --- a/service/test/adapters/observations/adapters.observations.db.mongoose.test.ts +++ b/service/test/adapters/observations/adapters.observations.db.mongoose.test.ts @@ -3,13 +3,12 @@ import { expect } from 'chai' import mongoose from 'mongoose' import _ from 'lodash' import { MongooseMageEventRepository } from '../../../lib/adapters/events/adapters.events.db.mongoose' -import { MongooseObservationRepository } from '../../../lib/adapters/observations/adapters.observations.db.mongoose' +import { MongooseObservationRepository, ObservationModel } from '../../../lib/adapters/observations/adapters.observations.db.mongoose' import * as legacy from '../../../lib/models/observation' import * as legacyEvent from '../../../lib/models/event' import { MageEventDocument } from '../../../src/models/event' import { MageEvent, MageEventAttrs, MageEventCreateAttrs, MageEventId } from '../../../lib/entities/events/entities.events' -import { ObservationDocument, ObservationModel } from '../../../src/models/observation' import { ObservationAttrs, ObservationId, Observation, ObservationRepositoryError, ObservationRepositoryErrorCode, copyObservationAttrs, AttachmentContentPatchAttrs, copyAttachmentAttrs, AttachmentNotFoundError, AttachmentPatchAttrs, removeAttachment, validationResultMessage, ObservationDomainEventType, ObservationEmitted, PendingObservationDomainEvent, AttachmentsRemovedDomainEvent } from '../../../lib/entities/observations/entities.observations' import { AttachmentPresentationType, FormFieldType, Form, AttachmentMediaTypes } from '../../../lib/entities/events/entities.events.forms' import util from 'util' @@ -153,7 +152,7 @@ describe('mongoose observation repository', function() { expect(id).to.be.a.string expect(id).to.not.be.empty - expect(parsed.equals(found?._id)).to.be.true + expect(parsed.equals(found?._id || '')).to.be.true expect(idCount).to.equal(1) }) }) @@ -247,7 +246,7 @@ describe('mongoose observation repository', function() { }, { id: (new mongoose.Types.ObjectId()).toHexString(), - name: 'archived', + name: 'archive', userId: undefined } ] @@ -326,7 +325,7 @@ describe('mongoose observation repository', function() { coordinates: [ 12, 34 ] } putAttrs.states = [ - { name: 'archived', id: PendingEntityId } + { name: 'archive', id: PendingEntityId } ] putAttrs.properties.forms = [ { @@ -412,7 +411,7 @@ describe('mongoose observation repository', function() { state1Stub.states = [ { id: PendingEntityId, - name: 'archived', + name: 'archive', userId: (new mongoose.Types.ObjectId()).toHexString() } ] diff --git a/service/test/app/observations/app.observations.test.ts b/service/test/app/observations/app.observations.test.ts index 79931f3fb..7a3ffe8a4 100644 --- a/service/test/app/observations/app.observations.test.ts +++ b/service/test/app/observations/app.observations.test.ts @@ -290,7 +290,7 @@ describe('observations use case interactions', function() { expect(exo.state).to.be.undefined const states: ObservationState[] = [ - { id: uniqid(), name: 'archived', userId: uniqid() }, + { id: uniqid(), name: 'archive', userId: uniqid() }, { id: uniqid(), name: 'active', userId: uniqid() } ] from.states = states.map(copyObservationStateAttrs) @@ -1418,7 +1418,7 @@ describe('observations use case interactions', function() { id: uniqid(), states: [ { id: uniqid(), name: 'active', userId: uniqid() }, - { id: uniqid(), name: 'archived', userId: uniqid() } + { id: uniqid(), name: 'archive', userId: uniqid() } ] }, mageEvent) as Observation const obsAfter = Observation.assignTo(obsBefore, {