diff --git a/db/migrations/20240523105650_adapt_upload_for_storing_geojsons/migration.sql b/db/migrations/20240523105650_adapt_upload_for_storing_geojsons/migration.sql
new file mode 100644
index 000000000..d859c6c6c
--- /dev/null
+++ b/db/migrations/20240523105650_adapt_upload_for_storing_geojsons/migration.sql
@@ -0,0 +1,12 @@
+-- CreateEnum
+CREATE TYPE "UploadCreatedByEnum" AS ENUM ('USER', 'SCRIPT');
+
+-- CreateEnum
+CREATE TYPE "UploadTypeEnum" AS ENUM ('GEOJSON', 'PMTILES');
+
+-- AlterTable
+ALTER TABLE "Upload"
+ RENAME COLUMN "pmtilesUrl" TO "url";
+ALTER TABLE "Upload"
+ ADD COLUMN "createdBy" "UploadCreatedByEnum" NOT NULL DEFAULT 'SCRIPT',
+ ADD COLUMN "type" "UploadTypeEnum" NOT NULL DEFAULT 'PMTILES';
diff --git a/db/schema.prisma b/db/schema.prisma
index f779ce3ab..5c565e54d 100644
--- a/db/schema.prisma
+++ b/db/schema.prisma
@@ -131,14 +131,26 @@ model Membership {
}
model Upload {
- id Int @id @default(autoincrement())
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
+ id Int @id @default(autoincrement())
+ createdAt DateTime @default(now())
+ createdBy UploadCreatedByEnum @default(SCRIPT)
+ updatedAt DateTime @updatedAt
//
- slug String @unique
- pmtilesUrl String
- configs Json
- public Boolean @default(false)
+ slug String @unique
+ type UploadTypeEnum @default(PMTILES)
+ url String
+ configs Json
+ public Boolean @default(false)
//
- regions Region[]
+ regions Region[]
+}
+
+enum UploadCreatedByEnum {
+ USER
+ SCRIPT
+}
+
+enum UploadTypeEnum {
+ GEOJSON
+ PMTILES
}
diff --git a/db/seeds/pmtiles.ts b/db/seeds/pmtiles.ts
index bbfd4ea42..b6ffe1e6c 100644
--- a/db/seeds/pmtiles.ts
+++ b/db/seeds/pmtiles.ts
@@ -16,7 +16,7 @@ const seedUploads = async () => {
const seedUploadsNudafa: Prisma.UploadUncheckedCreateInput[] = [
{
slug: 'nudafa-combined',
- pmtilesUrl:
+ url:
'https://atlas-private.s3.eu-central-1.amazonaws.com/test-data/nudafa-combined.pmtiles',
configs: [
{
@@ -39,7 +39,7 @@ const seedUploads = async () => {
const seedUploadsBibi: Prisma.UploadUncheckedCreateInput[] = [
{
slug: 'two-configs',
- pmtilesUrl:
+ url:
'https://atlas-private.s3.eu-central-1.amazonaws.com/test-data/nudafa-combined.pmtiles',
configs: [
{
diff --git a/scripts/StaticDatasets/api.ts b/scripts/StaticDatasets/api.ts
index e34408ffc..d8149f02b 100644
--- a/scripts/StaticDatasets/api.ts
+++ b/scripts/StaticDatasets/api.ts
@@ -33,7 +33,7 @@ export const getRegions = async (): Promise<{ id: number; slug: string }[]> => {
type UploadData = {
uploadSlug: string
- pmtilesUrl: string
+ url: string
regionSlugs: string[]
isPublic: boolean
configs: Record
- Vorschau für Devs (_API_KEY_
aus .env
/Bitwarden für{' '}
- {process.env.NEXT_PUBLIC_APP_ENV}
)
-
+ Datentyp: {upload.type}
+ TODO: add link to geojson viewer +
+ ) : ( +
+ Vorschau für Devs (_API_KEY_
aus .env
/Bitwarden für{' '}
+ {process.env.NEXT_PUBLIC_APP_ENV}
)
+
+
- Öffentliche URL {getStaticDatasetUrl(upload.slug)}
+ Öffentliche URL: {getStaticDatasetUrl(upload.slug)}
- Interne URL auf S3 {upload.pmtilesUrl}
+ Interne URL: {upload.url}