Create secondary upload for pool data
This commit is contained in:
parent
8bfad892bc
commit
9939434cb3
7 changed files with 472 additions and 175 deletions
|
|
@ -59,8 +59,11 @@ func Router() chi.Router {
|
|||
r.Method("GET", "/configuration/pesticide", authenticatedHandler(getConfigurationPesticide))
|
||||
r.Method("GET", "/configuration/pesticide/add", authenticatedHandler(getConfigurationPesticideAdd))
|
||||
r.Method("GET", "/configuration/upload", authenticatedHandler(getUploadList))
|
||||
r.Method("GET", "/configuration/upload/pool", authenticatedHandler(getUploadPoolCreate))
|
||||
r.Method("POST", "/configuration/upload/pool", authenticatedHandlerPostMultipart(postUploadPoolCreate))
|
||||
r.Method("GET", "/configuration/upload/pool", authenticatedHandler(getUploadPool))
|
||||
r.Method("GET", "/configuration/upload/pool/bob", authenticatedHandler(getUploadPoolBobCreate))
|
||||
r.Method("POST", "/configuration/upload/pool/bob", authenticatedHandlerPostMultipart(postUploadPoolBobCreate))
|
||||
r.Method("GET", "/configuration/upload/pool/custom", authenticatedHandler(getUploadPoolCustomCreate))
|
||||
r.Method("POST", "/configuration/upload/pool/custom", authenticatedHandlerPostMultipart(postUploadPoolCustomCreate))
|
||||
r.Method("GET", "/configuration/upload/{id}", authenticatedHandler(getUploadByID))
|
||||
r.Method("POST", "/configuration/upload/{id}/discard", authenticatedHandlerPost(postUploadDiscard))
|
||||
r.Method("GET", "/configuration/user", authenticatedHandler(getConfigurationUserList))
|
||||
|
|
|
|||
|
|
@ -45,12 +45,26 @@ type contentUploadDetail struct {
|
|||
type contentUploadPoolList struct {
|
||||
Uploads []platform.PoolUpload
|
||||
}
|
||||
type contentUploadPoolCreate struct{}
|
||||
type contentUploadPool struct{}
|
||||
|
||||
func getUploadPoolCreate(ctx context.Context, r *http.Request, org *models.Organization, u *models.User) (*response[contentUploadPoolCreate], *errorWithStatus) {
|
||||
data := contentUploadPoolCreate{}
|
||||
func getUploadPool(ctx context.Context, r *http.Request, org *models.Organization, u *models.User) (*response[contentUploadPool], *errorWithStatus) {
|
||||
data := contentUploadPool{}
|
||||
return newResponse("sync/upload-csv-pool.html", data), nil
|
||||
}
|
||||
|
||||
type contentUploadPoolBobCreate struct{}
|
||||
|
||||
func getUploadPoolBobCreate(ctx context.Context, r *http.Request, org *models.Organization, u *models.User) (*response[contentUploadPoolBobCreate], *errorWithStatus) {
|
||||
data := contentUploadPoolBobCreate{}
|
||||
return newResponse("sync/upload-csv-pool-bob.html", data), nil
|
||||
}
|
||||
|
||||
type contentUploadPoolCustomCreate struct{}
|
||||
|
||||
func getUploadPoolCustomCreate(ctx context.Context, r *http.Request, org *models.Organization, u *models.User) (*response[contentUploadPoolCustomCreate], *errorWithStatus) {
|
||||
data := contentUploadPoolCustomCreate{}
|
||||
return newResponse("sync/upload-csv-pool-custom.html", data), nil
|
||||
}
|
||||
func getUploadByID(ctx context.Context, r *http.Request, org *models.Organization, u *models.User) (*response[contentUploadDetail], *errorWithStatus) {
|
||||
file_id_str := chi.URLParam(r, "id")
|
||||
file_id_, err := strconv.ParseInt(file_id_str, 10, 32)
|
||||
|
|
@ -88,7 +102,10 @@ func postUploadDiscard(ctx context.Context, r *http.Request, org *models.Organiz
|
|||
|
||||
type FormUploadPool struct{}
|
||||
|
||||
func postUploadPoolCreate(ctx context.Context, r *http.Request, org *models.Organization, u *models.User, f FormUploadPool) (string, *errorWithStatus) {
|
||||
func postUploadPoolBobCreate(ctx context.Context, r *http.Request, org *models.Organization, u *models.User, f FormUploadPool) (string, *errorWithStatus) {
|
||||
return "", nil
|
||||
}
|
||||
func postUploadPoolCustomCreate(ctx context.Context, r *http.Request, org *models.Organization, u *models.User, f FormUploadPool) (string, *errorWithStatus) {
|
||||
uploads, err := userfile.SaveFileUpload(r, "csvfile", userfile.CollectionCSV)
|
||||
if err != nil {
|
||||
return "", newError("Failed to extract image uploads: %s", err)
|
||||
|
|
|
|||
22
sync/url.go
22
sync/url.go
|
|
@ -9,10 +9,9 @@ type contentURL struct {
|
|||
OAuthRefreshArcGIS string
|
||||
Root string
|
||||
Route string
|
||||
SamplePoolCSV string
|
||||
Sidebar contentURLSidebar
|
||||
Tegola string
|
||||
UploadCSVPool string
|
||||
Upload contentURLUpload
|
||||
}
|
||||
|
||||
func newContentURL() contentURL {
|
||||
|
|
@ -21,10 +20,9 @@ func newContentURL() contentURL {
|
|||
OAuthRefreshArcGIS: config.MakeURLNidus("/arcgis/oauth/begin"),
|
||||
Root: config.MakeURLNidus("/"),
|
||||
Route: config.MakeURLNidus("/route"),
|
||||
SamplePoolCSV: config.MakeURLNidus("/static/file/sample-pool.csv"),
|
||||
Sidebar: newContentURLSidebar(),
|
||||
Tegola: config.MakeURLTegola("/"),
|
||||
UploadCSVPool: config.MakeURLNidus("/configuration/upload/pool"),
|
||||
Upload: newContentURLUpload(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -75,3 +73,19 @@ func newContentURLSidebar() contentURLSidebar {
|
|||
Review: config.MakeURLNidus("/review"),
|
||||
}
|
||||
}
|
||||
|
||||
type contentURLUpload struct {
|
||||
Pool string
|
||||
PoolBob string
|
||||
PoolCustom string
|
||||
SamplePoolCSV string
|
||||
}
|
||||
|
||||
func newContentURLUpload() contentURLUpload {
|
||||
return contentURLUpload{
|
||||
Pool: config.MakeURLNidus("/configuration/upload/pool"),
|
||||
PoolBob: config.MakeURLNidus("/configuration/upload/pool/bob"),
|
||||
PoolCustom: config.MakeURLNidus("/configuration/upload/pool/custom"),
|
||||
SamplePoolCSV: config.MakeURLNidus("/static/file/sample-pool.csv"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue