Skip to content

Commit

Permalink
fix(service): observation state name was supposed to be archive, no…
Browse files Browse the repository at this point in the history
…t `archived`
  • Loading branch information
restjohn committed Aug 6, 2024
1 parent fc2694c commit 526a88d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions service/src/entities/observations/entities.observations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -668,7 +668,7 @@ export function removeFormEntry(observation: Observation, formEntryId: FormEntry
return Observation.assignTo(observation, mod) as Observation
}

export type AttachmentCreateAttrs = Omit<Attachment, 'id' | 'observationFormId' | 'fieldName' | 'lastModified'>
export type AttachmentCreateAttrs = Omit<Attachment, 'id' | 'observationFormId' | 'fieldName' | 'lastModified' | 'url'>
export type AttachmentPatchAttrs = Partial<AttachmentCreateAttrs>
export type AttachmentContentPatchAttrs = Required<Pick<Attachment, 'contentLocator' | 'size'>>
export type ThumbnailContentPatchAttrs = Required<Pick<Thumbnail, 'contentLocator' | 'size'>> & Thumbnail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)
})
})
Expand Down Expand Up @@ -247,7 +246,7 @@ describe('mongoose observation repository', function() {
},
{
id: (new mongoose.Types.ObjectId()).toHexString(),
name: 'archived',
name: 'archive',
userId: undefined
}
]
Expand Down Expand Up @@ -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 = [
{
Expand Down Expand Up @@ -412,7 +411,7 @@ describe('mongoose observation repository', function() {
state1Stub.states = [
{
id: PendingEntityId,
name: 'archived',
name: 'archive',
userId: (new mongoose.Types.ObjectId()).toHexString()
}
]
Expand Down
4 changes: 2 additions & 2 deletions service/test/app/observations/app.observations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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, {
Expand Down

0 comments on commit 526a88d

Please sign in to comment.