Skip to content

Commit

Permalink
Use same code as old test
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarvelle committed Feb 27, 2025
1 parent 632a0c3 commit 1f468c3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class AudioControllerTest extends UnitSuite with TestEnvironment with Retries wi
| "audioFile": "test.mp3",
| "copyright": {
| "license": {
| "license": "${License.CC_BY.toString}"
| "license": "${License.CC_BY_SA.toString}"
| },
| "origin": "",
| "creators": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
package no.ndla.common.model.domain

import com.scalatsi.{TSNamedType, TSType}
import com.scalatsi.TypescriptType.{TSEnum, TSLiteralString, TSUnion}
import com.scalatsi.TypescriptType.{TSLiteralString, TSUnion}
import enumeratum.*
import no.ndla.common.CirceUtil.CirceEnumWithErrors
import no.ndla.common.errors.ValidationException
Expand Down Expand Up @@ -55,10 +55,22 @@ object ContributorType extends Enum[ContributorType] with CirceEnumWithErrors[Co
)
)

def creators: Seq[ContributorType] = Seq(Artist, CoWriter, Composer, Director, Illustrator, Originator, Photographer, Reader, ScriptWriter, Translator, Writer)
def creators: Seq[ContributorType] = Seq(
Artist,
CoWriter,
Composer,
Director,
Illustrator,
Originator,
Photographer,
Reader,
ScriptWriter,
Translator,
Writer
)
def processors: Seq[ContributorType] = Seq(Compiler, Correction, Editorial, Facilitator, Idea, Linguistic, Processor)
def rightsholders: Seq[ContributorType] = Seq(Distributor, Publisher, RightsHolder, Supplier)
def contributors: Seq[ContributorType] = creators ++ processors ++ rightsholders
def contributors: Seq[ContributorType] = creators ++ processors ++ rightsholders

// TODO: Remove when all data are converted
val mapping: Map[String, ContributorType] = Map(
Expand Down Expand Up @@ -87,7 +99,7 @@ object ContributorType extends Enum[ContributorType] with CirceEnumWithErrors[Co
"tilrettelegger" -> ContributorType.Facilitator
).withDefaultValue(ContributorType.Writer)

implicit def schema: Schema[ContributorType] = schemaForEnumEntry[ContributorType]
implicit def schema: Schema[ContributorType] = schemaForEnumEntry[ContributorType]
implicit val enumTsType: TSNamedType[ContributorType] =
TSType.alias[ContributorType]("ContributorType", TSUnion(values.map(e => TSLiteralString(e.entryName))))
}

0 comments on commit 1f468c3

Please sign in to comment.