Skip to content

Commit

Permalink
Refactor hasFragmentLink, createLinkFor for Museum
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikpaliwal committed Feb 18, 2024
1 parent 0bb89a9 commit 95cae3f
Showing 1 changed file with 1 addition and 43 deletions.
44 changes: 1 addition & 43 deletions src/fragmentarium/domain/fragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import produce, { castDraft, Draft, immerable } from 'immer'

import Reference from 'bibliography/domain/Reference'
import { Text } from 'transliteration/domain/text'
import { Museum, FragmentLink } from './museum'
import { Museum } from './museum'
import Folio from './Folio'
import { Genres } from 'fragmentarium/domain/Genres'
import { Joins } from './join'
Expand Down Expand Up @@ -78,36 +78,6 @@ export interface ScriptDto {

export class Fragment {
readonly [immerable] = true
museumKey:
| 'ISTANBUL_ARKEOLOJI_MUSEUM'
| 'THE_IRAQ_MUSEUM'
| 'PENN_MUSEUM'
| 'ASHMOLEAN_MUSEUM'
| 'PHYSICIANS_COLLEGE_PHILADELPHIA'
| 'COUVENT_SAINT_ETIENNE'
| 'REDPATH_MUSEUM'
| 'HILPRECHT_COLLECTION'
| 'HEARST_MUSEUM'
| 'RYLANDS_INSTITUTE'
| 'KELSEY_MUSEUM'
| 'KUNSTHISTORISCHES_MUSEUM'
| 'LOUVRE'
| 'MUSEE_D_ART'
| 'MUSEES_ROYAUX'
| 'NATIONALMUSEET'
| 'OAKLAND_MUSEUM'
| 'ANCIENT_CULTURES_CHICAGO'
| 'PIERPONT_MORGAN'
| 'PONTIFICAL_BIBLICAL_INSTITUTE'
| 'ROSICRUCIAN_EGYPTIAN_MUSEUM'
| 'THE_BRITISH_MUSEUM'
| 'TRINITY_COLLEGE_DUBLIN'
| 'VATICAN_MUSEUMS'
| 'VORDERASIATISCHES_MUSEUM'
| 'THE_WALTERS_ART_MUSEUM'
| 'YALE_PEABODY_COLLECTION'
| 'ECOLE_PRATIQUE_DES_HAUTES_ETUDES'
| 'UNKNOWN'

constructor(
readonly number: string,
Expand Down Expand Up @@ -248,18 +218,6 @@ export class Fragment {
})
}

get hasLink(): boolean {
return this.museum.hasFragmentLink(this)
}

getLink(): FragmentLink {
if (this.hasLink) {
return this.museum.createLinkFor(this)
} else {
throw new Error(`No link available for this fragment.`)
}
}

filterFolios(session: Session): Fragment {
return produce(this, (draft: Draft<Fragment>) => {
draft.folios = this.folios.filter((folio) =>
Expand Down

0 comments on commit 95cae3f

Please sign in to comment.