doppiab-dev / RPG-Pal

A tool to help Pathfinder and D&D3.5 Masters&Players.
Creative Commons Zero v1.0 Universal
3 stars 0 forks source link

Gestione Campagna #11

Open DrBlink7 opened 7 months ago

DrBlink7 commented 7 months ago

Implementare API per visualizzare la Campagna

Create campagna

API Crea campagna POST master/campaign

REQ

body: {name: string}

RES

return 200 
body: {  
  id: number
  name: string
  groups: number
  status: CampaignStatus
}

Edit campagna

API Modifica nome o status PATCH master/campaign/:id

REQ

body: {name: string, status:  CampaignStatus}

RES

return 204 
empty body ? check for ORM @Zxcid 

Delete campagna

API cancella campagna Delete master/campaign/:id

REQ

no body

RES

return 204 
empty body ? check for ORM @Zxcid 

Fetch Campagna

API recupera info di una campagna. GET master/campaign/:id

REQ

no body

RES

return 200 
body {
  id: number
  name: string
  description: string
  plot: string
  placesOfInterest: PlacesOfInterestDTO
  groups: CampaignGroupDTO[]
}

// types
interface PlacesOfInterestDTO {
  points: CampaignPlaceOfInterestDTO[]
  roots: number[]
}
interface CampaignGroupDTO {
  id: number
  name: string
}
type PlacesOfInterestType = keyof typeof PlacesOfInterestEnum
enum PlacesOfInterestEnum {
  'world' = 'world',
  'continent' = 'continent',
  'region' = 'region',
  'area' = 'area',
  'city' = 'city',
  'camp' = 'camp',
  'neighborhood' = 'neighborhood',
  'point' = 'point'
}
interface CampaignPlaceOfInterestDTO {
  id: number
  name: string
  place: PlacesOfInterestType
  description: string
  parent?: number
  children?: number[]
}

Creare/modificare descrizione

API Upsert descrizione campagna PUT master/campaign/:id/description

REQ

body: { description: string }

RES

return 204 
empty body ? check for ORM @Zxcid 

Creare/modificare plot

API Upsert plot campagna PUT master/campaign/:id/plot

REQ

body: { plot: string }

RES

return 204 
empty body ? check for ORM @Zxcid 

Cancella punto di interesse

API DeletePoi PUT master/campaign/:id/poi/:poi

REQ

body: noBody

RES

return 200
body PlacesOfInterestDTO (vedi sopra)

Modifica nome punto di interesse

API editPoiName PATCH master/campaign/:id/poi/:poi

REQ

body: {name: string}

RES

return 200
body PlacesOfInterestDTO (vedi sopra)

Modifica punto di interesse

API editPoi PATCH master/campaign/:id/poi/:poi

REQ

body: {description: string, parent: string | null } // N.B. parent chiave numerica incrementale (fare cast e gestire eventuali errori)

RES

return 200
body PlacesOfInterestDTO (vedi sopra)

Crea punto di interesse

API createPoi POST master/campaign/:id/poi

REQ

body: {name: string, parent: string | null, type: PlacesOfInterestType } // N.B. parent chiave numerica incrementale (fare cast e gestire eventuali errori)

RES

return 200
body PlacesOfInterestDTO (vedi sopra)

Api di