commit 6964d963332ee36036db3844329008ab2b6ca94f
parent 7590095c9ec4d08196ab17b669c22a0b33245e4d
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Mon, 23 Sep 2024 16:09:59 -0700
Use spaceplanner schema for floorplan_id function call
Diffstat:
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/internal/backend/floorplan_data.go b/internal/backend/floorplan_data.go
@@ -250,7 +250,7 @@ func (e *Env) getFloorplanFurnitureDefs(tx *sql.Tx, user string, floorplan strin
defsStmt, err := e.CacheTxStmt(tx, "furniture_defs",
`SELECT id, type, name, width, depth
FROM spaceplanner.furniture
- WHERE floorplan = floorplan_id($1, $2)`)
+ WHERE floorplan = spaceplanner.floorplan_id($1, $2)`)
if err != nil {
return nil, err
}
@@ -277,7 +277,7 @@ func (e *Env) getFloorplanFurnitureMaps(tx *sql.Tx, user string, floorplan strin
WHERE furniture_id IN (
SELECT id
FROM spaceplanner.furniture
- WHERE floorplan = floorplan_id($1, $2)
+ WHERE floorplan = spaceplanner.floorplan_id($1, $2)
)`)
if err != nil {
return nil, err
@@ -539,7 +539,7 @@ func (p Point) Create(e *Env, tx *sql.Tx, user, floorplan string) (DBObject, err
func (p Point) Update(e *Env, tx *sql.Tx, user string, floorplan string) (DBObject, error) {
stmt, err := e.CacheTxStmt(tx, "repl_point", `UPDATE spaceplanner.floorplan_points SET (x, y) = ($4, $5)
- WHERE floorplan = floorplan_id($1, $2) AND id = $3 RETURNING id, x, y`)
+ WHERE floorplan = spaceplanner.floorplan_id($1, $2) AND id = $3 RETURNING id, x, y`)
if err != nil {
return Point{}, err
}
@@ -553,7 +553,7 @@ func (p Point) Delete(e *Env, tx *sql.Tx, user string, floorplan string) (DBObje
func (e *Env) DeletePoint(tx *sql.Tx, user string, floorplan string, id ObjectID) (Point, error) {
stmt, err := e.CacheTxStmt(tx, "dele_point",
- `DELETE FROM spaceplanner.floorplan_points WHERE floorplan = floorplan_id($1, $2) AND id = $3
+ `DELETE FROM spaceplanner.floorplan_points WHERE floorplan = spaceplanner.floorplan_id($1, $2) AND id = $3
RETURNING id, x, y`)
if err != nil {
return Point{}, err
@@ -565,7 +565,7 @@ func (e *Env) DeletePoint(tx *sql.Tx, user string, floorplan string, id ObjectID
func (pm PointMap) Create(e *Env, tx *sql.Tx, user string, floorplan string) (DBObject, error) {
stmt, err := e.CacheTxStmt(tx, "add_pointmap",
`INSERT INTO spaceplanner.floorplan_pointmaps (floorplan, type, a, b, door_swing) VALUES (
- floorplan_id($1, $2), $3, $4, $5, $6
+ spaceplanner.floorplan_id($1, $2), $3, $4, $5, $6
) RETURNING id, type, a, b, door_swing`)
if err != nil {
return PointMap{}, err
@@ -577,7 +577,7 @@ func (pm PointMap) Create(e *Env, tx *sql.Tx, user string, floorplan string) (DB
func (pm PointMap) Update(e *Env, tx *sql.Tx, user string, floorplan string) (DBObject, error) {
stmt, err := e.CacheTxStmt(tx, "repl_pointmap",
`UPDATE spaceplanner.floorplan_pointmaps SET (type, a, b, door_swing) =
- ($4, $5, $6, $7) WHERE floorplan = floorplan_id($1, $2) AND id = $3
+ ($4, $5, $6, $7) WHERE floorplan = spaceplanner.floorplan_id($1, $2) AND id = $3
RETURNING id, type, a, b, door_swing`)
if err != nil {
return PointMap{}, err
@@ -593,7 +593,7 @@ func (pm PointMap) Delete(e *Env, tx *sql.Tx, user, floorplan string) (DBObject,
func (e *Env) DeletePointMap(tx *sql.Tx, user string, floorplan string, id ObjectID) (PointMap, error) {
stmt, err := e.CacheTxStmt(tx, "dele_pointmap",
`DELETE FROM spaceplanner.floorplan_pointmaps
- WHERE floorplan = floorplan_id($1, $2) AND id = $3
+ WHERE floorplan = spaceplanner.floorplan_id($1, $2) AND id = $3
RETURNING id, type, a, b, door_swing`)
if err != nil {
return PointMap{}, err
@@ -605,7 +605,7 @@ func (e *Env) DeletePointMap(tx *sql.Tx, user string, floorplan string, id Objec
func (f Furniture) Create(e *Env, tx *sql.Tx, user, floorplan string) (DBObject, error) {
ins, err := e.CacheTxStmt(tx, "add_furn",
`INSERT INTO spaceplanner.furniture (floorplan, type, name, width, depth)
- VALUES (floorplan_id($1, $2), $3, $4, $5, $6)
+ VALUES (spaceplanner.floorplan_id($1, $2), $3, $4, $5, $6)
RETURNING id, type, name, width, depth`)
if err != nil {
return f, err
@@ -617,7 +617,7 @@ func (f Furniture) Create(e *Env, tx *sql.Tx, user, floorplan string) (DBObject,
func (f Furniture) Update(e *Env, tx *sql.Tx, user, floorplan string) (DBObject, error) {
update, err := e.CacheTxStmt(tx, "update_furn",
`UPDATE spaceplanner.furniture SET (type, name, width, depth) =
- ($4, $5, $6, $7) WHERE floorplan = floorplan_id($1, $2) AND id = $3
+ ($4, $5, $6, $7) WHERE floorplan = spaceplanner.floorplan_id($1, $2) AND id = $3
RETURNING id, type, name, width, depth`)
if err != nil {
return f, err
@@ -629,7 +629,7 @@ func (f Furniture) Update(e *Env, tx *sql.Tx, user, floorplan string) (DBObject,
func (f Furniture) Delete(e *Env, tx *sql.Tx, user, floorplan string) (DBObject, error) {
del, err := e.CacheTxStmt(tx, "dele_furn",
`DELETE FROM spaceplanner.furniture
- WHERE floorplan = floorplan_id($1, $2) AND id = $3
+ WHERE floorplan = spaceplanner.floorplan_id($1, $2) AND id = $3
RETURNING id, type, name, width, depth`)
if err != nil {
return f, err
@@ -641,7 +641,7 @@ func (f Furniture) Delete(e *Env, tx *sql.Tx, user, floorplan string) (DBObject,
func (f FurnitureMap) Create(e *Env, tx *sql.Tx, user, floorplan string) (DBObject, error) {
ins, err := e.CacheTxStmt(tx, "add_furnmap",
`INSERT INTO spaceplanner.furniture_maps (floorplan, furniture_id, layout, x, y, angle)
- VALUES (floorplan_id($1, $2), $3, $4, $5, $6, $7)
+ VALUES (spaceplanner.floorplan_id($1, $2), $3, $4, $5, $6, $7)
RETURNING id, furniture_id, layout, x, y, angle`)
if err != nil {
return f, err
@@ -653,7 +653,7 @@ func (f FurnitureMap) Create(e *Env, tx *sql.Tx, user, floorplan string) (DBObje
func (fm FurnitureMap) Update(e *Env, tx *sql.Tx, user, floorplan string) (DBObject, error) {
update, err := e.CacheTxStmt(tx, "update_furnmap",
`UPDATE spaceplanner.furniture_maps SET (furniture_id, layout, x, y, angle) =
- ($4, $5, $6, $7, $8) WHERE floorplan = floorplan_id($1, $2) AND id = $3
+ ($4, $5, $6, $7, $8) WHERE floorplan = spaceplanner.floorplan_id($1, $2) AND id = $3
RETURNING id, furniture_id, layout, x, y, angle`)
if err != nil {
return fm, err
@@ -665,7 +665,7 @@ func (fm FurnitureMap) Update(e *Env, tx *sql.Tx, user, floorplan string) (DBObj
func (f FurnitureMap) Delete(e *Env, tx *sql.Tx, user, floorplan string) (DBObject, error) {
del, err := e.CacheTxStmt(tx, "dele_furnmap",
`DELETE FROM spaceplanner.furniture_maps
- WHERE floorplan = floorplan_id($1, $2) AND id = $3
+ WHERE floorplan = spaceplanner.floorplan_id($1, $2) AND id = $3
RETURNING id, furniture_id, layout, x, y, angle`)
if err != nil {
return f, err