my-kaiqiuwang/prisma/schema.prisma
kyuuseiryuu fd8257e194 feat(api): add user location management endpoints and database model
- Added `UserLocation` model to `prisma/schema.prisma` to store user location data including coordinates (point geometry), name, avatar, and bindings to Logto and Kaiqiu users.
- Created new API endpoints under `/api/account/location` to handle location operations:
  - `POST`: Create a new location record for a user.
  - `GET`: Retrieve nearby locations based on latitude and longitude.
  - `PUT`: Update an existing location record, including coordinate updates via spatial index.
  - `DELETE`: Remove a specific location record.
- Integrated the custom spatial operations from `xprisma` DAO to support geospatial queries and updates.
- Updated dependencies to include `@mui/icons-material` (and its peer dependencies like `prop-types` and `react-transition-group` which are implicitly required by the new icon components).
- Implemented `verifyLogtoToken` logic to secure the new endpoints and associate locations with authenticated users.

No breaking changes in API contracts; new endpoints are additive.
2026-03-19 00:29:02 +09:00

43 lines
872 B
Plaintext

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
datasource db {
provider = "mysql"
}
model LogtoUserFav {
logto_uid String
kaiqiu_uid String
@@id([logto_uid, kaiqiu_uid])
}
model EventSubs {
logto_uid String
event_id String
@@id([logto_uid, event_id])
}
model UserBind {
logto_uid String @unique
kaiqiu_uid String
}
model UserLocation {
id Int @id @default(autoincrement())
kaiqiu_uid String?
logto_uid String
name String
avatar String? @db.Text
coords Unsupported("point")
@@index([coords])
@@unique([logto_uid, name])
}