Buildings and levels for the floor map, and make every identifier searchable
This commit is contained in:
@@ -863,6 +863,63 @@ export const setupApi = {
|
||||
}
|
||||
}
|
||||
|
||||
// Buildings and the levels within them (ADR-017). Reads are public - the
|
||||
// printer installer map draws a blueprint before anyone logs in.
|
||||
export const mapLevelsApi = {
|
||||
list() {
|
||||
return api.get('/maplevels')
|
||||
},
|
||||
get(levelid) {
|
||||
return api.get(`/maplevels/${levelid}`)
|
||||
},
|
||||
createBuilding(payload) {
|
||||
return api.post('/maplevels/buildings', payload)
|
||||
},
|
||||
updateBuilding(buildingid, payload) {
|
||||
return api.patch(`/maplevels/buildings/${buildingid}`, payload)
|
||||
},
|
||||
create(payload) {
|
||||
return api.post('/maplevels', payload)
|
||||
},
|
||||
update(levelid, payload) {
|
||||
return api.patch(`/maplevels/${levelid}`, payload)
|
||||
},
|
||||
remove(levelid) {
|
||||
return api.delete(`/maplevels/${levelid}`)
|
||||
},
|
||||
// Returns the image's real pixel size alongside the stored dimensions. On an
|
||||
// empty level the server adopts them; on a populated one it refuses and says
|
||||
// so, because changing the coordinate space moves every marker on it.
|
||||
uploadBlueprint(levelid, theme, file) {
|
||||
const form = new FormData()
|
||||
form.append('file', file)
|
||||
form.append('theme', theme)
|
||||
return api.post(`/maplevels/${levelid}/blueprint`, form, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
// Bulk marker positions: the landmark transform, bulk placement, review state
|
||||
// and undo. Every write snapshots first.
|
||||
export const mapPositionsApi = {
|
||||
setPositions(positions, verified = true) {
|
||||
return api.post('/mappositions/positions', { positions, verified })
|
||||
},
|
||||
transform(payload) {
|
||||
return api.post('/mappositions/transform', payload)
|
||||
},
|
||||
verify(assetids, unverify = false) {
|
||||
return api.post('/mappositions/verify', { assetids, unverify })
|
||||
},
|
||||
snapshots() {
|
||||
return api.get('/mappositions/snapshots')
|
||||
},
|
||||
restore(snapshotid) {
|
||||
return api.post(`/mappositions/snapshots/${snapshotid}/restore`)
|
||||
},
|
||||
}
|
||||
|
||||
export const settingsApi = {
|
||||
list(params = {}) {
|
||||
return api.get('/settings', { params })
|
||||
|
||||
Reference in New Issue
Block a user