Skip to content

Commit

Permalink
refactor: extract interface
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Nov 5, 2024
1 parent 2d4d9d1 commit 7db0fad
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions apis/shared-dimensions/lib/domain/shared-dimension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ import * as queries from './shared-dimension/queries'

export { importDimension } from './shared-dimension/import'

interface Contributor {
name: string
email?: string
}

interface CreateSharedDimension {
resource: GraphPointer<NamedNode>
store: SharedDimensionsStore
contributor: {
name: string
email?: string
}
contributor: Contributor
}

export async function create({ resource, store, contributor }: CreateSharedDimension): Promise<GraphPointer> {
Expand Down Expand Up @@ -87,10 +89,7 @@ interface UpdateSharedDimension {
store: SharedDimensionsStore
shape: MultiPointer | undefined
queries?: typeof queries
contributor: {
name: string
email?: string
}
contributor: Contributor
}

function removeSubgraph(pointer: GraphPointer, predicate?: Term) {
Expand Down Expand Up @@ -128,10 +127,7 @@ export async function update({ resource, store, shape, queries, contributor }: U
return resource
}

function setDefaultContributor(termSet: GraphPointer, contributor: {
name: string
email?: string
}) {
function setDefaultContributor(termSet: GraphPointer, contributor: Contributor) {
if (termSet.out(dcterms.contributor).terms.length === 0) {
termSet.addOut(dcterms.contributor, contributorPtr => {
contributorPtr.addOut(schema.name, contributor.name)
Expand Down

0 comments on commit 7db0fad

Please sign in to comment.