Skip to content

Commit

Permalink
Merge pull request #1789 from serlo/staging
Browse files Browse the repository at this point in the history
Deployment
  • Loading branch information
hugotiburtino authored Oct 30, 2024
2 parents 7ecbd7f + a5c6e2b commit dde84f4
Show file tree
Hide file tree
Showing 31 changed files with 144 additions and 93 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions __tests__/schema/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ test('endpoint `publisher` returns publisher', async () => {
})
})

/**
* For more complete and complex tests go to `serlo/metadata-exports` and run `pipenv run validate_local`. Remember to run `yarn mysql:import-anonymous-data` first.
*/
describe('endpoint "resources"', () => {
const query = new Client().prepareQuery({
query: gql`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"@luckycatfactory/esbuild-graphql-loader": "^3.8.1",
"@tsconfig/node20": "^20.1.4",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.8",
"@types/node": "^22.8.1",
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"default-import": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/db-migrations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@slack/web-api": "^7.4.0",
"@tsconfig/node20": "^20.1.4",
"@types/jest": "^29.5.12",
"@types/node": "^18.19.50",
"@types/node": "^22.8.1",
"@types/ramda": "^0.30.2",
"@types/semver": "^7.5.8",
"@types/uuid": "^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@
"redlock": "^5.0.0-beta2",
"semver": "^7.6.3",
"ts-toolbelt": "^9.6.0",
"uuid": "^10.0.0"
"uuid": "^11.0.1"
}
}
24 changes: 21 additions & 3 deletions packages/server/src/schema/metadata/resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as R from 'ramda'

import { captureErrorEvent } from '~/error-event'
import { UserInputError } from '~/errors'
import { createNamespace, decodeId } from '~/internals/graphql'
import { resolveConnection } from '~/schema/connection/utils'
Expand Down Expand Up @@ -112,8 +113,8 @@ export const resolvers: Resolvers = {
JOIN subject_mapping ON subject_mapping.taxonomy_id = child.parent_id
-- "Fächer im Aufbau" taxonomy is on the level of normal Serlo subjects, therefore we need a level below it.
-- "Partner" taxonomy is below the subject "Mathematik", but we only want the entities with the specific partner as the subject.
WHERE child.parent_id NOT IN (87993, 106081, 146728)
-- Exclude content under "Baustelle", "Community", "Zum Testen" and "Testbereich" taxonomies
-- Exclude content under "Baustelle", "Community" (from de, en and es instances), "Zum Testen" and "Testbereich" taxonomies
WHERE child.parent_id NOT IN (87993, 106081, 146728, 48537, 164234, 141588, 268835, 146870)
AND child.id NOT IN (75211, 105140, 107772, 135390, 25107, 106082)
)
SELECT
Expand Down Expand Up @@ -150,6 +151,7 @@ export const resolvers: Resolvers = {
AND type.name IN ("applet", "article", "course", "text-exercise",
"text-exercise-group", "video")
AND NOT subject_mapping.subject_id = 146728
AND license.url NOT LIKE "https://www.youtube.com/static?%"
GROUP BY entity.id
ORDER BY entity.id
LIMIT ?
Expand Down Expand Up @@ -419,7 +421,9 @@ function getRaWSubject(id: number): RawSubject[] {
case 18230:
return [{ id: '1002', scheme: Scheme.SchoolSubject }]
// Biologie (Schule)
// Forensik 195927
case 23362:
case 195927:
return [{ id: '1001', scheme: Scheme.SchoolSubject }]
// Englisch (Shule)
case 25979:
Expand All @@ -436,7 +440,6 @@ function getRaWSubject(id: number): RawSubject[] {
// Informatik (Schule)
case 47899:
return [{ id: '1013', scheme: Scheme.SchoolSubject }]

// Politik => Politik, Sachunterricht (Schule)
case 79159:
case 107556:
Expand All @@ -460,8 +463,10 @@ function getRaWSubject(id: number): RawSubject[] {
case 112723:
return [{ id: '1006', scheme: Scheme.SchoolSubject }]
// Geschichte (Schule)
// Estudios en Diásporas Africanas 242308
case 136362:
case 140528:
case 242308:
return [{ id: '1011', scheme: Scheme.SchoolSubject }]
// Wirtschaftskunde (Schule)
case 137757:
Expand Down Expand Up @@ -506,7 +511,20 @@ function getRaWSubject(id: number): RawSubject[] {
{ id: '1043', scheme: Scheme.SchoolSubject },
{ id: '1005', scheme: Scheme.SchoolSubject },
]
// Lerntipps, => Erziehungswissenschaft (Schule)
case 181883:
case 148619:
return [{ id: '1043', scheme: Scheme.SchoolSubject }]
default:
captureErrorEvent({
error: new Error(
'metadata: subject could not be mapped to field `about`',
),
errorContext: {
subjectId: id,
warning: 'It will break the export to Mein Bildungsraum',
},
})
return []
}
}
Expand Down
12 changes: 0 additions & 12 deletions packages/server/src/schema/uuid/user/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,6 @@ export const resolvers: Resolvers = {
if (id == null) {
throw new UserInputError('no user with given username')
}
await database.mutate(
`
INSERT INTO role (name)
SELECT ?
WHERE NOT EXISTS (
SELECT 1
FROM role
WHERE name = ?
)
`,
[generateRole(role, instance), generateRole(role, instance)],
)

await database.mutate(
`
Expand Down
Loading

0 comments on commit dde84f4

Please sign in to comment.