Skip to content

Commit 55e1da5

Browse files
Merge pull request #1789 from serlo/staging
Deployment
2 parents 4a691d1 + de04518 commit 55e1da5

File tree

7 files changed

+144
-93
lines changed

7 files changed

+144
-93
lines changed

__tests__/schema/metadata.ts

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ test('endpoint `publisher` returns publisher', async () => {
2929
})
3030
})
3131

32+
/**
33+
* 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.
34+
*/
3235
describe('endpoint "resources"', () => {
3336
const query = new Client().prepareQuery({
3437
query: gql`

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"@luckycatfactory/esbuild-graphql-loader": "^3.8.1",
9393
"@tsconfig/node20": "^20.1.4",
9494
"@types/jest": "^29.5.12",
95-
"@types/node": "^20.14.8",
95+
"@types/node": "^22.8.1",
9696
"@typescript-eslint/eslint-plugin": "^8.6.0",
9797
"@typescript-eslint/parser": "^8.6.0",
9898
"default-import": "^2.0.1",

packages/db-migrations/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@slack/web-api": "^7.4.0",
2727
"@tsconfig/node20": "^20.1.4",
2828
"@types/jest": "^29.5.12",
29-
"@types/node": "^18.19.50",
29+
"@types/node": "^22.8.1",
3030
"@types/ramda": "^0.30.2",
3131
"@types/semver": "^7.5.8",
3232
"@types/uuid": "^10.0.0",

packages/server/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@
6565
"redlock": "^5.0.0-beta2",
6666
"semver": "^7.6.3",
6767
"ts-toolbelt": "^9.6.0",
68-
"uuid": "^10.0.0"
68+
"uuid": "^11.0.1"
6969
}
7070
}

packages/server/src/schema/metadata/resolvers.ts

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as R from 'ramda'
22

3+
import { captureErrorEvent } from '~/error-event'
34
import { UserInputError } from '~/errors'
45
import { createNamespace, decodeId } from '~/internals/graphql'
56
import { resolveConnection } from '~/schema/connection/utils'
@@ -112,8 +113,8 @@ export const resolvers: Resolvers = {
112113
JOIN subject_mapping ON subject_mapping.taxonomy_id = child.parent_id
113114
-- "Fächer im Aufbau" taxonomy is on the level of normal Serlo subjects, therefore we need a level below it.
114115
-- "Partner" taxonomy is below the subject "Mathematik", but we only want the entities with the specific partner as the subject.
115-
WHERE child.parent_id NOT IN (87993, 106081, 146728)
116-
-- Exclude content under "Baustelle", "Community", "Zum Testen" and "Testbereich" taxonomies
116+
-- Exclude content under "Baustelle", "Community" (from de, en and es instances), "Zum Testen" and "Testbereich" taxonomies
117+
WHERE child.parent_id NOT IN (87993, 106081, 146728, 48537, 164234, 141588, 268835, 146870)
117118
AND child.id NOT IN (75211, 105140, 107772, 135390, 25107, 106082)
118119
)
119120
SELECT
@@ -150,6 +151,7 @@ export const resolvers: Resolvers = {
150151
AND type.name IN ("applet", "article", "course", "text-exercise",
151152
"text-exercise-group", "video")
152153
AND NOT subject_mapping.subject_id = 146728
154+
AND license.url NOT LIKE "https://www.youtube.com/static?%"
153155
GROUP BY entity.id
154156
ORDER BY entity.id
155157
LIMIT ?
@@ -419,7 +421,9 @@ function getRaWSubject(id: number): RawSubject[] {
419421
case 18230:
420422
return [{ id: '1002', scheme: Scheme.SchoolSubject }]
421423
// Biologie (Schule)
424+
// Forensik 195927
422425
case 23362:
426+
case 195927:
423427
return [{ id: '1001', scheme: Scheme.SchoolSubject }]
424428
// Englisch (Shule)
425429
case 25979:
@@ -436,7 +440,6 @@ function getRaWSubject(id: number): RawSubject[] {
436440
// Informatik (Schule)
437441
case 47899:
438442
return [{ id: '1013', scheme: Scheme.SchoolSubject }]
439-
440443
// Politik => Politik, Sachunterricht (Schule)
441444
case 79159:
442445
case 107556:
@@ -460,8 +463,10 @@ function getRaWSubject(id: number): RawSubject[] {
460463
case 112723:
461464
return [{ id: '1006', scheme: Scheme.SchoolSubject }]
462465
// Geschichte (Schule)
466+
// Estudios en Diásporas Africanas 242308
463467
case 136362:
464468
case 140528:
469+
case 242308:
465470
return [{ id: '1011', scheme: Scheme.SchoolSubject }]
466471
// Wirtschaftskunde (Schule)
467472
case 137757:
@@ -506,7 +511,20 @@ function getRaWSubject(id: number): RawSubject[] {
506511
{ id: '1043', scheme: Scheme.SchoolSubject },
507512
{ id: '1005', scheme: Scheme.SchoolSubject },
508513
]
514+
// Lerntipps, => Erziehungswissenschaft (Schule)
515+
case 181883:
516+
case 148619:
517+
return [{ id: '1043', scheme: Scheme.SchoolSubject }]
509518
default:
519+
captureErrorEvent({
520+
error: new Error(
521+
'metadata: subject could not be mapped to field `about`',
522+
),
523+
errorContext: {
524+
subjectId: id,
525+
warning: 'It will break the export to Mein Bildungsraum',
526+
},
527+
})
510528
return []
511529
}
512530
}

packages/server/src/schema/uuid/user/resolvers.ts

-12
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,6 @@ export const resolvers: Resolvers = {
320320
if (id == null) {
321321
throw new UserInputError('no user with given username')
322322
}
323-
await database.mutate(
324-
`
325-
INSERT INTO role (name)
326-
SELECT ?
327-
WHERE NOT EXISTS (
328-
SELECT 1
329-
FROM role
330-
WHERE name = ?
331-
)
332-
`,
333-
[generateRole(role, instance), generateRole(role, instance)],
334-
)
335323

336324
await database.mutate(
337325
`

0 commit comments

Comments
 (0)