Fix publicreport creation
The consistency is good, but I added some errors, like not using an enum
This commit is contained in:
parent
1d2570c912
commit
341c3ef6b9
6 changed files with 95 additions and 25 deletions
|
|
@ -163,6 +163,7 @@ func postNuisance(w http.ResponseWriter, r *http.Request) {
|
|||
ReporterEmail: omit.From(""),
|
||||
ReporterName: omit.From(""),
|
||||
ReporterPhone: omit.From(""),
|
||||
ReportType: omit.From(enums.PublicreportReporttypeNuisance),
|
||||
Status: omit.From(enums.PublicreportReportstatustypeReported),
|
||||
}
|
||||
setter_nuisance := models.PublicreportNuisanceSetter{
|
||||
|
|
@ -183,6 +184,6 @@ func postNuisance(w http.ResponseWriter, r *http.Request) {
|
|||
TodEvening: omit.From(tod_evening),
|
||||
TodNight: omit.From(tod_night),
|
||||
}
|
||||
public_id, err := platform.ReportNuisanceCreate(ctx, setter_report, setter_nuisance, latlng, address, uploads)
|
||||
http.Redirect(w, r, fmt.Sprintf("/submit-complete?report=%s", public_id), http.StatusFound)
|
||||
report, err := platform.ReportNuisanceCreate(ctx, setter_report, setter_nuisance, latlng, address, uploads)
|
||||
http.Redirect(w, r, fmt.Sprintf("/submit-complete?report=%s", report.PublicID), http.StatusFound)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@ func postWater(w http.ResponseWriter, r *http.Request) {
|
|||
AddressRegion: omit.From(address_region),
|
||||
Created: omit.From(time.Now()),
|
||||
//H3cell: omitnull.From(geospatial.Cell.String()),
|
||||
LatlngAccuracyType: omit.From(latlng.AccuracyType),
|
||||
LatlngAccuracyValue: omit.From(float32(latlng.AccuracyValue)),
|
||||
//Location: add later
|
||||
MapZoom: omit.From(latlng.MapZoom),
|
||||
//OrganizationID: omitnull.FromPtr(organization_id),
|
||||
|
|
@ -114,6 +116,7 @@ func postWater(w http.ResponseWriter, r *http.Request) {
|
|||
ReporterEmail: omit.From(""),
|
||||
ReporterName: omit.From(""),
|
||||
ReporterPhone: omit.From(""),
|
||||
ReportType: omit.From(enums.PublicreportReporttypeWater),
|
||||
Status: omit.From(enums.PublicreportReportstatustypeReported),
|
||||
}
|
||||
setter_water := models.PublicreportWaterSetter{
|
||||
|
|
@ -135,12 +138,12 @@ func postWater(w http.ResponseWriter, r *http.Request) {
|
|||
OwnerPhone: omit.From(owner_phone),
|
||||
//ReportID omit.Val[int32]
|
||||
}
|
||||
public_id, err := platform.ReportWaterCreate(ctx, setter_report, setter_water, latlng, address, uploads)
|
||||
report, err := platform.ReportWaterCreate(ctx, setter_report, setter_water, latlng, address, uploads)
|
||||
if err != nil {
|
||||
respondError(w, "Failed to save new report", err, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, fmt.Sprintf("/submit-complete?report=%s", public_id), http.StatusFound)
|
||||
http.Redirect(w, r, fmt.Sprintf("/submit-complete?report=%s", report.PublicID), http.StatusFound)
|
||||
}
|
||||
func postWaterDistrict(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue