Switch to translatable data

This commit is contained in:
2025-08-20 23:18:40 +02:00
parent c35fb06830
commit cc544322b2
36 changed files with 431 additions and 146 deletions
@@ -0,0 +1,57 @@
-- AlterTable
ALTER TABLE "public"."Hunt"
ADD COLUMN "description_de" TEXT NOT NULL DEFAULT '',
ADD COLUMN "description_en" TEXT NOT NULL DEFAULT '',
ADD COLUMN "name_de" TEXT NOT NULL DEFAULT '',
ADD COLUMN "name_en" TEXT NOT NULL DEFAULT '';
update "public"."Hunt"
set description_en = description,
description_de = description,
name_en = name,
name_de = name
where description_de = '';
ALTER TABLE "public"."Hunt"
DROP COLUMN "description",
DROP COLUMN "name",
ALTER COLUMN name_de drop default,
ALTER COLUMN name_en drop default,
ALTER COLUMN description_de drop default,
ALTER COLUMN description_en drop default;
-- AlterTable
ALTER TABLE "public"."HuntQuest"
ADD COLUMN "description_de" TEXT NOT NULL DEFAULT '',
ADD COLUMN "description_en" TEXT NOT NULL DEFAULT '',
ADD COLUMN "extraText_de" TEXT,
ADD COLUMN "extraText_en" TEXT,
ADD COLUMN "question_de" TEXT,
ADD COLUMN "question_en" TEXT,
ADD COLUMN "title_de" TEXT NOT NULL DEFAULT '',
ADD COLUMN "title_en" TEXT NOT NULL DEFAULT '';
update "public"."HuntQuest"
set description_en = description,
description_de = description,
title_en = title,
title_de = title,
"extraText_en" = "extraText",
"extraText_de" = "extraText",
question_en = question,
question_de = question
where description_de = '';
ALTER TABLE "public"."HuntQuest"
DROP COLUMN "description",
DROP COLUMN "title",
DROP COLUMN question,
DROP COLUMN "extraText",
ALTER COLUMN title_de drop default,
ALTER COLUMN title_en drop default,
ALTER COLUMN description_de drop default,
ALTER COLUMN description_en drop default;
-- AlterTable
ALTER TABLE "public"."QuestAnswer"
ADD COLUMN "lang" CHAR(2) NOT NULL DEFAULT 'de';
+20 -12
View File
@@ -64,9 +64,11 @@ model File {
}
model Hunt {
id Int @id @default(autoincrement())
name String
description String
id Int @id @default(autoincrement())
name_en String
name_de String
description_en String
description_de String
virtual Boolean @default(false)
start DateTime? @db.Timestamptz(3)
@@ -154,12 +156,15 @@ enum TextType {
}
model HuntQuest {
id Int @id @default(autoincrement())
title String
description String @default("")
question String?
location String?
locationLink String?
id Int @id @default(autoincrement())
title_en String
title_de String
description_en String @default("")
description_de String @default("")
question_en String?
question_de String?
location String?
locationLink String?
picture File? @relation(fields: [pictureId], references: [id], onUpdate: Cascade, onDelete: Cascade)
pictureId Int?
@@ -172,9 +177,10 @@ model HuntQuest {
textUnit String?
textSolution String?
points Int @default(10) @db.SmallInt
extraPoints Int? @db.SmallInt
extraText String?
points Int @default(10) @db.SmallInt
extraPoints Int? @db.SmallInt
extraText_en String?
extraText_de String?
hunt Hunt @relation(fields: [huntId], references: [id], onUpdate: Cascade, onDelete: Cascade)
huntId Int
@@ -194,6 +200,8 @@ model QuestAnswer {
lon Decimal? @db.Decimal(10, 8)
final Boolean @default(false)
lang String @default("de") @db.Char(2)
team HuntTeam @relation(fields: [teamId], references: [id], onUpdate: Cascade, onDelete: Cascade)
teamId Int
+40 -18
View File
@@ -110,8 +110,10 @@ async function main() {
}
},
data: {
name: 'Bremer Stadtrallye!',
description: 'DIE Rallye durch Bremen!',
name_de: 'Bremer Stadtrallye!',
name_en: 'Bremer Stadtrallye!',
description_de: 'DIE Rallye durch Bremen!',
description_en: 'THE Rallye trough Bremen!',
start: new Date('2025-08-23T10:00:00.000Z'),
end: new Date('2025-08-30T10:00:00.000Z'),
allowJoin: true,
@@ -120,9 +122,12 @@ async function main() {
quests: {
create: [
{
title: 'MOIN!',
description: 'Finde das größte MOIN',
question: 'Wo steht es?',
title_de: 'MOIN!',
title_en: 'MOIN!',
description_de: 'Finde das größte MOIN',
description_en: 'Find the largest MOIN',
question_de: 'Wo steht es?',
question_en: 'Where is it?',
order: 0,
optional: false,
pictureRequired: true,
@@ -132,12 +137,18 @@ async function main() {
points: 10
},
{
title: 'Die Musikanten',
description:
title_de: 'Die Musikanten',
title_en: 'The Musikanten',
description_de:
'Dort wo die vier Bremer Tiere musizieren, müsst ihr ihre Beine anfassen!',
question: 'Wie viele Beine haben die Musikanten zusammen?',
extraText:
'Mehr Punkte, je mehr unterschiedliche Beine ihre berührt!',
description_en:
'Where the four Bremen music animals are, you have to touch their legs!',
question_de: 'Wie viele Beine haben die Musikanten zusammen?',
question_en: 'How many legs do the musicians have altogether?',
extraText_de:
'Mehr Punkte, je mehr unterschiedliche Beine ihr berührt!',
extraText_en:
'The more different legs you touch, the more points you get!',
points: 10,
extraPoints: 5,
pictureRequired: true,
@@ -148,32 +159,43 @@ async function main() {
order: 1
},
{
title: 'Tolle Aussicht',
description:
title_de: 'Tolle Aussicht',
title_en: 'Great view',
description_de:
'Mache ein Bild aus einem Gebäude der Hochschule, von so weit oben wie möglich!',
description_en:
'Take a picture of a university building from as high up as possible!',
points: 10,
extraPoints: 10,
extraText:
extraText_de:
'Wenn ihr das einzige Team in diesem Gebäude/Standort oder die Höchsten wart!',
extraText_en:
'If you were the only team in that building/location or on the highest floor!',
optional: false,
pictureRequired: true,
textRequired: false,
question: 'In welchem Gebäude und Stockwerk wart ihr?',
question_de: 'In welchem Gebäude und Stockwerk wart ihr?',
question_en: 'Which building and floor were you in?',
textType: 'TEXT',
order: 2
},
{
title: 'Einfach mal abhauen',
description:
title_de: 'Einfach mal abhauen',
title_en: 'Just get away',
description_de:
'Fahrt so weit ihr wollt und macht ein Foto vom Haltestellenschild!',
question: 'An welcher Haltestelle wart ihr?',
description_en:
'Drive as far as you want and take a photo of the bus stop sign!',
question_de: 'An welcher Haltestelle wart ihr?',
question_en: 'Which stop were you at?',
order: 3,
pictureRequired: true,
textRequired: true,
textType: 'TEXT',
points: 3,
extraPoints: 30,
extraText: 'Je weiter weg'
extraText_de: 'Je weiter weg',
extraText_en: 'The further away'
}
]
},