Skip to content

Commit

Permalink
Merge pull request #1469 from serlo/KEJhe-kulla-2024-05-05-12-59
Browse files Browse the repository at this point in the history
refactor: Migrate DB-Layer into entity namespace
  • Loading branch information
hugotiburtino authored Jun 8, 2024
2 parents 1de3412 + 6593cfc commit 060538a
Show file tree
Hide file tree
Showing 45 changed files with 1,283 additions and 2,084 deletions.
20 changes: 20 additions & 0 deletions __fixtures__/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,26 @@ const courseMetadata = {
},
],
creator: [
{
id: 'https://serlo.org/15473',
name: '125f3e12',
type: 'Person',
affiliation: {
id: 'https://serlo.org/organization',
name: 'Serlo Education e.V.',
type: 'Organization',
},
},
{
id: 'https://serlo.org/15491',
name: '125f4a84',
type: 'Person',
affiliation: {
id: 'https://serlo.org/organization',
name: 'Serlo Education e.V.',
type: 'Organization',
},
},
{
id: 'https://serlo.org/324',
name: '122d486a',
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/uuid/applet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const applet: Model<'Applet'> = {
trashed: false,
instance: Instance.En,
alias: '/math/35596/example-applet',
date: '2014-03-01T20:45:56Z',
date: '2020-01-29T17:47:19.000Z',
currentRevisionId: 35597,
revisionIds: [35597],
licenseId,
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/uuid/article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const article: ArticleWithAllFieldsDefined = {
trashed: false,
instance: Instance.De,
alias: '/mathe/1855/parabel',
date: '2014-03-01T20:45:56Z',
date: '2014-03-01T20:45:56.000Z',
currentRevisionId: 30674,
licenseId,
taxonomyTermIds: [5],
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/uuid/course-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const coursePage: Model<'CoursePage'> = {
trashed: false,
instance: Instance.De,
alias: '/mathe/18521/startseite',
date: '2014-03-01T20:45:56Z',
date: '2014-03-17T12:24:54.000Z',
currentRevisionId: 19277,
revisionIds: [19277],
licenseId,
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/uuid/course.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const course: Model<'Course'> = {
trashed: false,
instance: Instance.De,
alias: '/mathe/18514/überblick-zum-satz-des-pythagoras',
date: '2014-03-01T20:45:56Z',
date: '2014-03-17T12:22:17.000Z',
currentRevisionId: 30713,
revisionIds: [30713],
licenseId,
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/uuid/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const event: Model<'Event'> = {
trashed: false,
instance: Instance.De,
alias: '/mathe/35554/beispielveranstaltung',
date: '2014-03-01T20:45:56Z',
date: '2019-12-02T22:40:41.000Z',
currentRevisionId: 35555,
revisionIds: [35555],
licenseId,
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/uuid/exercise-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const exerciseGroup: Model<'ExerciseGroup'> = {
trashed: false,
instance: Instance.De,
alias: '/mathe/2217/2217',
date: '2014-03-01T20:45:56Z',
date: '2014-03-01T20:54:51.000Z',
currentRevisionId: 2218,
revisionIds: [2218],
licenseId,
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/uuid/exercise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const exercise: Model<'Exercise'> = {
trashed: false,
instance: Instance.De,
alias: '/mathe/29637/29637',
date: '2014-03-01T20:45:56Z',
date: '2014-09-08T10:42:33.000Z',
currentRevisionId: 29638,
revisionIds: [29638],
licenseId,
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/uuid/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const video: Model<'Video'> = {
trashed: false,
instance: Instance.De,
alias: '/mathe/32321/schriftliche-addition',
date: '2014-10-15T12:49:12+02:00',
date: '2014-10-15T12:49:12.000Z',
currentRevisionId: 32322,
revisionIds: [32322],
licenseId,
Expand Down
5 changes: 0 additions & 5 deletions __tests__/__utils__/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ const ForDefinitions = {
given('UuidQuery').withPayload({ id: uuid.id }).returns(uuid)
}
},
UnrevisedEntitiesQuery(entities: Model<'AbstractEntity'>[]) {
given('UnrevisedEntitiesQuery')
.withPayload({})
.returns({ unrevisedEntityIds: entities.map((entity) => entity.id) })
},
DeletedEntitiesQuery(entities: Model<'AbstractEntity'>[]) {
given('UuidQuery').for(
entities.map((entity) => {
Expand Down
85 changes: 85 additions & 0 deletions __tests__/__utils__/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,91 @@ import gql from 'graphql-tag'

import { Client } from './assertions'

export const entityQuery = new Client().prepareQuery({
query: gql`
query ($id: Int!) {
uuid(id: $id) {
... on AbstractUuid {
alias
}
... on AbstractEntity {
__typename
id
instance
trashed
date
title
licenseId
currentRevision {
id
}
revisions {
nodes {
id
}
}
}
... on AbstractTaxonomyTermChild {
taxonomyTerms {
nodes {
id
}
}
}
}
}
`,
variables: { id: 27801 },
})

export const entityRevisionQuery = new Client().prepareQuery({
query: gql`
query ($id: Int!) {
uuid(id: $id) {
... on AbstractUuid {
alias
}
... on AbstractEntityRevision {
__typename
id
author {
id
}
trashed
date
repository {
id
}
title
content
changes
metaTitle
metaDescription
url
}
}
}
`,
variables: { id: 35296 },
})

export const userQueryUnrevisedEntities = new Client().prepareQuery({
query: gql`
query ($id: Int!) {
uuid(id: $id) {
... on User {
unrevisedEntities {
nodes {
id
}
}
}
}
}
`,
variables: { id: 299 },
})

export const taxonomyTermQuery = new Client().prepareQuery({
query: gql`
query ($id: Int!) {
Expand Down
Loading

0 comments on commit 060538a

Please sign in to comment.