Mercurial > gemma
annotate pkg/controllers/uploadedimports.go @ 5275:73563c4bba5b wfs-optional-sortby
Slight improvement of log messages for fd import.
author | wilde@azure1.rgb.intevation.de |
---|---|
date | Tue, 09 Jun 2020 10:43:43 +0200 |
parents | f9bb06f2dbe3 |
children | 5f47eeea988d |
rev | line source |
---|---|
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 // This is Free Software under GNU Affero General Public License v >= 3.0 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 // without warranty, see README.md and license for details. |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 // |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 // SPDX-License-Identifier: AGPL-3.0-or-later |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 // License-Filename: LICENSES/AGPL-3.0.txt |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 // |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 // Copyright (C) 2018 by via donau |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 // – Österreichische Wasserstraßen-Gesellschaft mbH |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 // Software engineering by Intevation GmbH |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 // |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 // Author(s): |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de> |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 package controllers |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import ( |
2537
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
17 "fmt" |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 "log" |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 "net/http" |
2536
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
20 "os" |
2537
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
21 "strconv" |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 "time" |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 "gemma.intevation.de/gemma/pkg/auth" |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 "gemma.intevation.de/gemma/pkg/common" |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 "gemma.intevation.de/gemma/pkg/imports" |
4244
4394daeea96a
Moved JSONHandler into middleware package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4183
diff
changeset
|
27 mw "gemma.intevation.de/gemma/pkg/middleware" |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 "gemma.intevation.de/gemma/pkg/misc" |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 ) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 const maxUploadSize = 25 * 1024 * 1024 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 |
4183
34623265eac1
Made 'golint' happy (again) with the controllers package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2995
diff
changeset
|
33 // badUploadParameterError is a local type to find bad request parameters. |
34623265eac1
Made 'golint' happy (again) with the controllers package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2995
diff
changeset
|
34 type badUploadParameterError string |
2536
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
35 |
2537
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
36 func importWaterwayProfiles() http.HandlerFunc { |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
37 return uploadedImport( |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
38 imports.WPJobKind, |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
39 "wp.csv", |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
40 func(req *http.Request, dir string) (imports.Job, error) { |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
41 url := req.FormValue("url") |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
42 if url == "" { |
4183
34623265eac1
Made 'golint' happy (again) with the controllers package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2995
diff
changeset
|
43 return nil, badUploadParameterError("missing 'url' parameter") |
2537
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
44 } |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
45 |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
46 featureType := req.FormValue("feature-type") |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
47 if featureType == "" { |
4183
34623265eac1
Made 'golint' happy (again) with the controllers package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2995
diff
changeset
|
48 return nil, badUploadParameterError("missing 'feature-type' parameter") |
2537
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
49 } |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
50 |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
51 sortBy := req.FormValue("sort-by") |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
52 |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
53 var precision *float64 |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
54 if p := req.FormValue("precision"); p != "" { |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
55 v, err := strconv.ParseFloat(p, 64) |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
56 if err != nil { |
4183
34623265eac1
Made 'golint' happy (again) with the controllers package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2995
diff
changeset
|
57 return nil, badUploadParameterError( |
2537
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
58 fmt.Sprintf("Invalid 'precision' parameter: %v", err)) |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
59 } |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
60 precision = &v |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
61 } |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
62 |
2723
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2586
diff
changeset
|
63 user := req.FormValue("user") |
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2586
diff
changeset
|
64 password := req.FormValue("password") |
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2586
diff
changeset
|
65 |
2537
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
66 return &imports.WaterwayProfiles{ |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
67 Dir: dir, |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
68 URL: url, |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
69 FeatureType: featureType, |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
70 SortBy: sortBy, |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
71 Precision: precision, |
2723
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2586
diff
changeset
|
72 User: user, |
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2586
diff
changeset
|
73 Password: password, |
2537
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
74 }, nil |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
75 }, |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
76 ) |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
77 } |
07f892bc4bb0
WP import: Made WP import an uploaded import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
78 |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 func importApprovedGaugeMeasurements() http.HandlerFunc { |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 return uploadedImport( |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 imports.AGMJobKind, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 "agm.csv", |
2562
ce39e9954e85
Make upload of AGM require only "fk_gauge_id" "measure_date" and "value"
Sascha Wilde <wilde@intevation.de>
parents:
2537
diff
changeset
|
83 func(req *http.Request, dir string) (imports.Job, error) { |
ce39e9954e85
Make upload of AGM require only "fk_gauge_id" "measure_date" and "value"
Sascha Wilde <wilde@intevation.de>
parents:
2537
diff
changeset
|
84 originator := req.FormValue("originator") |
ce39e9954e85
Make upload of AGM require only "fk_gauge_id" "measure_date" and "value"
Sascha Wilde <wilde@intevation.de>
parents:
2537
diff
changeset
|
85 if originator == "" { |
4183
34623265eac1
Made 'golint' happy (again) with the controllers package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2995
diff
changeset
|
86 return nil, badUploadParameterError("missing 'originator' parameter") |
2562
ce39e9954e85
Make upload of AGM require only "fk_gauge_id" "measure_date" and "value"
Sascha Wilde <wilde@intevation.de>
parents:
2537
diff
changeset
|
87 } |
ce39e9954e85
Make upload of AGM require only "fk_gauge_id" "measure_date" and "value"
Sascha Wilde <wilde@intevation.de>
parents:
2537
diff
changeset
|
88 |
ce39e9954e85
Make upload of AGM require only "fk_gauge_id" "measure_date" and "value"
Sascha Wilde <wilde@intevation.de>
parents:
2537
diff
changeset
|
89 return &imports.ApprovedGaugeMeasurements{ |
ce39e9954e85
Make upload of AGM require only "fk_gauge_id" "measure_date" and "value"
Sascha Wilde <wilde@intevation.de>
parents:
2537
diff
changeset
|
90 Dir: dir, |
ce39e9954e85
Make upload of AGM require only "fk_gauge_id" "measure_date" and "value"
Sascha Wilde <wilde@intevation.de>
parents:
2537
diff
changeset
|
91 Originator: originator, |
ce39e9954e85
Make upload of AGM require only "fk_gauge_id" "measure_date" and "value"
Sascha Wilde <wilde@intevation.de>
parents:
2537
diff
changeset
|
92 }, nil |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 }, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 ) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 } |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 func importUploadedBottleneck() http.HandlerFunc { |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 return uploadedImport( |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 imports.UBNJobKind, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 "data.xml", |
2586
bc1b43885a4d
Expose axis snapping tolerance in bottleneck upload import
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
101 func(req *http.Request, dir string) (imports.Job, error) { |
bc1b43885a4d
Expose axis snapping tolerance in bottleneck upload import
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
102 |
bc1b43885a4d
Expose axis snapping tolerance in bottleneck upload import
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
103 var tolerance float64 |
bc1b43885a4d
Expose axis snapping tolerance in bottleneck upload import
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
104 if t := req.FormValue("tolerance"); t != "" { |
bc1b43885a4d
Expose axis snapping tolerance in bottleneck upload import
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
105 v, err := strconv.ParseFloat(t, 64) |
bc1b43885a4d
Expose axis snapping tolerance in bottleneck upload import
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
106 if err != nil { |
4183
34623265eac1
Made 'golint' happy (again) with the controllers package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2995
diff
changeset
|
107 return nil, badUploadParameterError( |
2586
bc1b43885a4d
Expose axis snapping tolerance in bottleneck upload import
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
108 fmt.Sprintf("Invalid 'tolerance' parameter: %v", err)) |
bc1b43885a4d
Expose axis snapping tolerance in bottleneck upload import
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
109 } |
bc1b43885a4d
Expose axis snapping tolerance in bottleneck upload import
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
110 tolerance = v |
bc1b43885a4d
Expose axis snapping tolerance in bottleneck upload import
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
111 } |
bc1b43885a4d
Expose axis snapping tolerance in bottleneck upload import
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
112 |
bc1b43885a4d
Expose axis snapping tolerance in bottleneck upload import
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
113 return &imports.UploadedBottleneck{Dir: dir, Tolerance: tolerance}, nil |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 }, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 ) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 } |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 func importUploadedFairwayAvailability() http.HandlerFunc { |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 return uploadedImport( |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 imports.UFAJobKind, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 "data.xml", |
2536
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
122 func(_ *http.Request, dir string) (imports.Job, error) { |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
123 return &imports.UploadedFairwayAvailability{Dir: dir}, nil |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 }, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 ) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 } |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 func importUploadedGaugeMeasurement() http.HandlerFunc { |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
129 return uploadedImport( |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 imports.UGMJobKind, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 "data.xml", |
2536
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
132 func(_ *http.Request, dir string) (imports.Job, error) { |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
133 return &imports.UploadedGaugeMeasurement{Dir: dir}, nil |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 }, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 ) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 } |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
137 |
4311
f9bb06f2dbe3
Added stub for a shape upload stretch import. POST /api/imports/stsh
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4244
diff
changeset
|
138 func importUploadedStretchShape() http.HandlerFunc { |
f9bb06f2dbe3
Added stub for a shape upload stretch import. POST /api/imports/stsh
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4244
diff
changeset
|
139 return uploadedImport( |
f9bb06f2dbe3
Added stub for a shape upload stretch import. POST /api/imports/stsh
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4244
diff
changeset
|
140 imports.STSHJobKind, |
f9bb06f2dbe3
Added stub for a shape upload stretch import. POST /api/imports/stsh
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4244
diff
changeset
|
141 "stretch.zip", |
f9bb06f2dbe3
Added stub for a shape upload stretch import. POST /api/imports/stsh
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4244
diff
changeset
|
142 func(_ *http.Request, dir string) (imports.Job, error) { |
f9bb06f2dbe3
Added stub for a shape upload stretch import. POST /api/imports/stsh
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4244
diff
changeset
|
143 return &imports.StretchShape{Dir: dir}, nil |
f9bb06f2dbe3
Added stub for a shape upload stretch import. POST /api/imports/stsh
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4244
diff
changeset
|
144 }, |
f9bb06f2dbe3
Added stub for a shape upload stretch import. POST /api/imports/stsh
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4244
diff
changeset
|
145 ) |
f9bb06f2dbe3
Added stub for a shape upload stretch import. POST /api/imports/stsh
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4244
diff
changeset
|
146 } |
f9bb06f2dbe3
Added stub for a shape upload stretch import. POST /api/imports/stsh
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4244
diff
changeset
|
147 |
4183
34623265eac1
Made 'golint' happy (again) with the controllers package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2995
diff
changeset
|
148 func (bup badUploadParameterError) Error() string { |
2536
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
149 return string(bup) |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
150 } |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
151 |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
152 func uploadedImport( |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
153 kind imports.JobKind, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
154 fname string, |
2536
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
155 create func(*http.Request, string) (imports.Job, error), |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
156 ) http.HandlerFunc { |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
157 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
158 return func(rw http.ResponseWriter, req *http.Request) { |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
159 dir, err := misc.StoreUploadedFile( |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 req, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
161 string(kind), |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
162 fname, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
163 maxUploadSize) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
164 if err != nil { |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
165 log.Printf("error: %v\n", err) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
166 http.Error(rw, "error: "+err.Error(), http.StatusInternalServerError) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
167 return |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
168 } |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
169 |
2536
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
170 job, err := create(req, dir) |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
171 if err != nil { |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
172 if err2 := os.RemoveAll(dir); err2 != nil { |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
173 log.Printf("warn: %v\n", err2) |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
174 } |
4183
34623265eac1
Made 'golint' happy (again) with the controllers package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2995
diff
changeset
|
175 if err2, ok := err.(badUploadParameterError); ok { |
2536
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
176 http.Error(rw, string(err2), http.StatusBadRequest) |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
177 return |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
178 } |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
179 log.Printf("error: %v\n", err) |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
180 http.Error(rw, "error: "+err.Error(), http.StatusInternalServerError) |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
181 return |
0a3debcfbe8f
Upload imports: Increased power of upload imports to be able to cope parameterized imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2256
diff
changeset
|
182 } |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
183 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
184 serialized, err := common.ToJSONString(job) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
185 if err != nil { |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
186 log.Printf("error: %v\n", err) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
187 http.Error(rw, "error: "+err.Error(), http.StatusInternalServerError) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
188 return |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
189 } |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
190 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
191 session, _ := auth.GetSession(req) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
192 |
2995
5222bfe5b4af
Upload imports: spell form field 'send-email' instead of 'email'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2723
diff
changeset
|
193 sendEmail := req.FormValue("send-email") != "" |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
194 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
195 jobID, err := imports.AddJob( |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
196 kind, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
197 time.Time{}, // due |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
198 nil, // trys |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
199 nil, // retry wait |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
200 session.User, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
201 sendEmail, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
202 serialized) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
203 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
204 if err != nil { |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
205 log.Printf("error: %v\n", err) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
206 http.Error(rw, "error: "+err.Error(), http.StatusInternalServerError) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
207 return |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
208 } |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
209 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
210 log.Printf("info: added import #%d to queue\n", jobID) |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
211 |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
212 result := struct { |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
213 ID int64 `json:"id"` |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
214 }{ |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
215 ID: jobID, |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
216 } |
4244
4394daeea96a
Moved JSONHandler into middleware package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4183
diff
changeset
|
217 mw.SendJSON(rw, http.StatusCreated, &result) |
2256
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
218 } |
0d272d7bcfb9
Uploaded imports: Unified agm, ubn, ufa and ugm import endpoints and removed a lot c&p code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
219 } |