Ajout endpoint géolocalisation

This commit is contained in:
2024-12-07 15:11:47 +01:00
parent 1ae6b6634c
commit 86427bb41b
13 changed files with 240 additions and 21 deletions

View File

@ -0,0 +1,14 @@
/*
Warnings:
- Added the required column `accuracy` to the `Geolocation` table without a default value. This is not possible if the table is not empty.
- Added the required column `altitude` to the `Geolocation` table without a default value. This is not possible if the table is not empty.
- Added the required column `altitudeAccuracy` to the `Geolocation` table without a default value. This is not possible if the table is not empty.
- Added the required column `speed` to the `Geolocation` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Geolocation" ADD COLUMN "accuracy" DOUBLE PRECISION NOT NULL,
ADD COLUMN "altitude" DOUBLE PRECISION NOT NULL,
ADD COLUMN "altitudeAccuracy" DOUBLE PRECISION NOT NULL,
ADD COLUMN "speed" DOUBLE PRECISION NOT NULL;

View File

@ -20,12 +20,16 @@ model User {
}
model Geolocation {
id Int @id @default(autoincrement())
userId Int
longitude Float
latitude Float
timestamp DateTime
user User @relation(fields: [userId], references: [id])
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int
longitude Float
latitude Float
speed Float
accuracy Float
altitude Float
altitudeAccuracy Float
timestamp DateTime
}
model Challenge {
@ -38,17 +42,18 @@ model Challenge {
model ChallengeAction {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int
challenge Challenge @relation(fields: [challengeId], references: [id])
challengeId Int @unique
active Boolean @default(false)
success Boolean @default(false)
challenge Challenge @relation(fields: [challengeId], references: [id])
user User @relation(fields: [userId], references: [id])
moneyUpdate MoneyUpdate?
}
model TrainTrip {
id String @id
user User @relation(fields: [userId], references: [id])
userId Int
distance Float
from String
@ -58,20 +63,19 @@ model TrainTrip {
infoJson Json
geometry String
moneyUpdate MoneyUpdate?
user User @relation(fields: [userId], references: [id])
}
model MoneyUpdate {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int
before Int
after Int
reason MoneyUpdateType
actionId Int? @unique
tripId String? @unique
action ChallengeAction? @relation(fields: [actionId], references: [id])
actionId Int? @unique
trip TrainTrip? @relation(fields: [tripId], references: [id])
user User @relation(fields: [userId], references: [id])
tripId String? @unique
}
enum MoneyUpdateType {