Mercurial > gemma
changeset 5332:9df7b39297ed extented-report
Merged.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 01 Jun 2021 00:23:25 +0200 |
parents | 5b2faff9ec81 (current diff) b1b9b384540d (diff) |
children | 6c0f40676984 |
files | |
diffstat | 3 files changed, 26 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/controllers/user.go Tue Jun 01 00:22:33 2021 +0200 +++ b/pkg/controllers/user.go Tue Jun 01 00:23:25 2021 +0200 @@ -37,22 +37,22 @@ const ( createUserSQL = `INSERT INTO users.list_users - VALUES ($1, $2, $3, $4, NULL, $5)` + VALUES ($1, $2, $3, $4, NULL, $5, $6)` createUserExtentSQL = `INSERT INTO users.list_users VALUES ($1, $2, $3, $4, - ST_MakeBox2D(ST_Point($5, $6), ST_Point($7, $8)), $9)` + ST_MakeBox2D(ST_Point($5, $6), ST_Point($7, $8)), $9, $10)` updateUserUnprivSQL = `UPDATE users.list_users SET (pw, map_extent, email_address) = ($2, ST_MakeBox2D(ST_Point($3, $4), ST_Point($5, $6)), $7) WHERE username = $1` updateUserSQL = `UPDATE users.list_users - SET (rolname, username, pw, country, map_extent, email_address) - = ($2, $3, $4, $5, NULL, $6) + SET (rolname, username, pw, country, map_extent, email_address, report_reciever) + = ($2, $3, $4, $5, NULL, $6, $7) WHERE username = $1` updateUserExtentSQL = `UPDATE users.list_users - SET (rolname, username, pw, country, map_extent, email_address) - = ($2, $3, $4, $5, ST_MakeBox2D(ST_Point($6, $7), ST_Point($8, $9)), $10) + SET (rolname, username, pw, country, map_extent, email_address, report_reciever) + = ($2, $3, $4, $5, ST_MakeBox2D(ST_Point($6, $7), ST_Point($8, $9)), $10, $11) WHERE username = $1` deleteUserSQL = `DELETE FROM users.list_users WHERE username = $1` @@ -63,7 +63,8 @@ country, email_address, ST_XMin(map_extent), ST_YMin(map_extent), - ST_XMax(map_extent), ST_YMax(map_extent) + ST_XMax(map_extent), ST_YMax(map_extent), + report_reciever FROM users.list_users` listUserSQL = `SELECT @@ -71,7 +72,8 @@ country, email_address, ST_XMin(map_extent), ST_YMin(map_extent), - ST_XMax(map_extent), ST_YMax(map_extent) + ST_XMax(map_extent), ST_YMax(map_extent), + report_reciever FROM users.list_users WHERE username = $1` ) @@ -181,6 +183,7 @@ newUser.Password, newUser.Country, newUser.Email, + newUser.Reports, ) } else { res, err = db.ExecContext( @@ -194,6 +197,7 @@ newUser.Extent.X1, newUser.Extent.Y1, newUser.Extent.X2, newUser.Extent.Y2, newUser.Email, + newUser.Reports, ) } } else { @@ -256,6 +260,7 @@ user.Password, user.Country, user.Email, + user.Reports, ) } else { _, err = db.ExecContext( @@ -268,6 +273,7 @@ user.Extent.X1, user.Extent.Y1, user.Extent.X2, user.Extent.Y2, user.Email, + user.Reports, ) } @@ -307,6 +313,7 @@ &user.Email, &user.Extent.X1, &user.Extent.Y1, &user.Extent.X2, &user.Extent.Y2, + &user.Reports, ); err != nil { return } @@ -343,6 +350,7 @@ &result.Email, &result.Extent.X1, &result.Extent.Y1, &result.Extent.X2, &result.Extent.Y2, + &result.Reports, ) switch { @@ -382,6 +390,7 @@ &userData.Email, &userData.Extent.X1, &userData.Extent.Y1, &userData.Extent.X2, &userData.Extent.Y2, + &userData.Reports, ) switch {
--- a/pkg/imports/report.go Tue Jun 01 00:22:33 2021 +0200 +++ b/pkg/imports/report.go Tue Jun 01 00:23:25 2021 +0200 @@ -19,9 +19,11 @@ "errors" "gemma.intevation.de/gemma/pkg/common" + "gemma.intevation.de/gemma/pkg/models" ) type Report struct { + models.QueueConfigurationType Name string `json:"Name"` } @@ -48,11 +50,17 @@ func (*Report) CleanUp() error { return nil } func (r *Report) MarshalAttributes(attrs common.Attributes) error { + if err := r.QueueConfigurationType.MarshalAttributes(attrs); err != nil { + return err + } attrs.Set("name", r.Name) return nil } func (r *Report) UnmarshalAttributes(attrs common.Attributes) error { + if err := r.QueueConfigurationType.UnmarshalAttributes(attrs); err != nil { + return err + } name, found := attrs.Get("name") if !found { return errors.New("missing 'name' attribute")
--- a/pkg/models/user.go Tue Jun 01 00:22:33 2021 +0200 +++ b/pkg/models/user.go Tue Jun 01 00:23:25 2021 +0200 @@ -46,6 +46,7 @@ Password string `json:"password,omitempty"` Email Email `json:"email"` Country Country `json:"country"` + Reports bool `json:"reports,omitempty"` Extent *BoundingBox `json:"extent"` }