Skip to content

Commit

Permalink
Revert "Update Accession Interface (#407)" (#408)
Browse files Browse the repository at this point in the history
This reverts commit 88df00a.
  • Loading branch information
fsimonjetz authored Nov 21, 2023
1 parent 88df00a commit 9f45faa
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 70 deletions.
2 changes: 1 addition & 1 deletion src/fragmentarium/domain/FragmentDtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export type ExternalNumbers = {

export default interface FragmentDto {
museumNumber: MuseumNumber
accession: MuseumNumber
accession: string
editedInOraccProject: string
publication: string
description: string
Expand Down
60 changes: 1 addition & 59 deletions src/fragmentarium/infrastructure/FragmentRepository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import { QueryResult } from 'query/QueryResult'
import { FragmentQuery } from 'query/FragmentQuery'
import { queryItemFactory } from 'test-support/query-item-factory'
import { museumNumberToString } from 'fragmentarium/domain/MuseumNumber'
import { Genre, Genres } from 'fragmentarium/domain/Genres'
import { mesopotamianDateFactory } from 'test-support/date-fixtures'
import { archaeologyFactory } from 'test-support/fragment-fixtures'

const apiClient = {
fetchJson: jest.fn(),
Expand All @@ -33,12 +30,6 @@ const folio = new Folio({ name: 'MJG', number: 'K1' })
const word = 'šim'
const introduction = 'Introduction'
const lemmas = 'foo I+bar II'
const genres: Genre[] = [
new Genre(['ARCHIVE', 'Letter'], false),
new Genre(['CANONICAL', 'Divination'], true),
]
const mesopotamianDate = mesopotamianDateFactory.build()
const archaeology = archaeologyFactory.build()
const museumNumber = { prefix: 'A', number: '7', suffix: '' }
const queryResult: QueryResult = {
items: [
Expand Down Expand Up @@ -323,56 +314,7 @@ const testData: TestData<FragmentRepository>[] = [
fragment,
[
`/fragments/${encodeURIComponent(fragmentId)}/introduction`,
{ introduction },
],
Promise.resolve(fragmentDto)
),
new TestData(
'updateGenres',
[fragmentId, new Genres(genres)],
apiClient.postJson,
fragment,
[`/fragments/${encodeURIComponent(fragmentId)}/genres`, { genres }],
Promise.resolve(fragmentDto)
),
new TestData(
'updateDate',
[fragmentId, mesopotamianDate],
apiClient.postJson,
fragment,
[
`/fragments/${encodeURIComponent(fragmentId)}/date`,
{ date: mesopotamianDate },
],
Promise.resolve(fragmentDto)
),
new TestData(
'updateDatesInText',
[fragmentId, [mesopotamianDate]],
apiClient.postJson,
fragment,
[
`/fragments/${encodeURIComponent(fragmentId)}/dates_in_text`,
{ datesInText: [mesopotamianDate] },
],
Promise.resolve(fragmentDto)
),
new TestData(
'updateNotes',
[fragmentId, notes],
apiClient.postJson,
fragment,
[`/fragments/${encodeURIComponent(fragmentId)}/notes`, { notes }],
Promise.resolve(fragmentDto)
),
new TestData(
'updateArchaeology',
[fragmentId, archaeology],
apiClient.postJson,
fragment,
[
`/fragments/${encodeURIComponent(fragmentId)}/archaeology`,
{ archaeology },
{ introduction: introduction },
],
Promise.resolve(fragmentDto)
),
Expand Down
1 change: 0 additions & 1 deletion src/fragmentarium/infrastructure/FragmentRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ function createFragment(dto: FragmentDto): Fragment {
return Fragment.create({
...dto,
number: museumNumberToString(dto.museumNumber),
accession: museumNumberToString(dto.accession),
museum: Museum.of(dto.museum),
joins: createJoins(dto.joins),
measures: {
Expand Down
2 changes: 1 addition & 1 deletion src/fragmentarium/ui/SearchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class SearchForm extends Component<Props, State> {
type="text"
name="number"
value={this.state.number || ''}
placeholder="Museum, accession, CDLI, or ecavation number"
placeholder="Museum, accession, or CDLI number"
aria-label="Number"
onChange={(
event: React.ChangeEvent<HTMLTextAreaElement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ exports[`Searching fragments by transliteration Displays corpus results when cli
class="form-control"
id="number"
name="number"
placeholder="Museum, accession, CDLI, or ecavation number"
placeholder="Museum, accession, or CDLI number"
type="text"
value=""
/>
Expand Down
2 changes: 1 addition & 1 deletion src/test-support/fragment-fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export const fragmentFactory = Factory.define<Fragment>(
const museumNumber = `${chance.word()}.${sequence}`
return new Fragment(
museumNumber,
`${chance.word()}.${sequence}`,
chance.word(),
chance.sentence({ words: 4 }),
associations.joins ?? [
[
Expand Down
8 changes: 2 additions & 6 deletions src/test-support/test-fragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,7 @@ export const fragmentDto: FragmentDto = {
number: 'Fragment',
suffix: '',
},
accession: {
prefix: 'A',
number: '38',
suffix: 'b',
},
accession: '',
publication: 'electronic Babylonian Library',
description: 'A fragment to be used when testing the eBL application',
joins: [
Expand Down Expand Up @@ -427,7 +423,7 @@ export const fragmentDto: FragmentDto = {

export const fragment = new Fragment(
'Test.Fragment',
'A.38.b',
'',
'electronic Babylonian Library',
[
[
Expand Down

0 comments on commit 9f45faa

Please sign in to comment.