Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
camino
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
pnm-public
camino
Commits
0378f8e9
Unverified
Commit
0378f8e9
authored
1 year ago
by
BITARD Michaël
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(qgis): remet la compatibilité avec le plugin Camino Qgis (#646)
parent
c09f77d5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/api/src/api/rest/index.ts
+22
-6
22 additions, 6 deletions
packages/api/src/api/rest/index.ts
packages/api/src/index.ts
+5
-2
5 additions, 2 deletions
packages/api/src/index.ts
packages/api/tests/app.ts
+4
-1
4 additions, 1 deletion
packages/api/tests/app.ts
with
31 additions
and
9 deletions
packages/api/src/api/rest/index.ts
+
22
−
6
View file @
0378f8e9
...
@@ -66,13 +66,29 @@ type GenericFiltreValidator<T extends Readonly<CaminoFiltre[]>> = { [key in T[nu
...
@@ -66,13 +66,29 @@ type GenericFiltreValidator<T extends Readonly<CaminoFiltre[]>> = { [key in T[nu
const
generateFilterValidator
=
<
T
extends
readonly
CaminoFiltre
[]
>
(
filtresNames
:
T
)
=>
const
generateFilterValidator
=
<
T
extends
readonly
CaminoFiltre
[]
>
(
filtresNames
:
T
)
=>
z
.
object
<
GenericFiltreValidator
<
T
>>
(
z
.
object
<
GenericFiltreValidator
<
T
>>
(
filtresNames
.
reduce
(
filtresNames
.
reduce
((
acc
,
filtre
)
=>
{
(
acc
,
filtre
)
=>
({
const
validator
=
caminoFiltres
[
filtre
].
validator
// Ceci est un hack pour le plugin camino QGIS, car la requête générée par le plugin ne respecte pas le "standard" pour les tableaux
if
(
validator
.
_def
.
typeName
===
'
ZodArray
'
)
{
return
{
...
acc
,
[
filtre
]:
validator
.
or
(
z
.
string
()
.
transform
(
val
=>
val
.
split
(
'
,
'
))
.
pipe
(
validator
)
)
.
optional
(),
}
}
return
{
...
acc
,
...
acc
,
[
filtre
]:
caminoFiltres
[
filtre
].
validator
.
optional
(),
[
filtre
]:
validator
.
optional
(),
}),
}
{}
as
GenericFiltreValidator
<
T
>
},
{}
as
GenericFiltreValidator
<
T
>
)
)
)
)
const
commonValidator
=
<
T
extends
Readonly
<
NonEmptyArray
<
string
>>>
(
colonnes
:
T
,
formats
:
Readonly
<
[
'
json
'
,
...
DownloadFormat
[]]
>
)
=>
const
commonValidator
=
<
T
extends
Readonly
<
NonEmptyArray
<
string
>>>
(
colonnes
:
T
,
formats
:
Readonly
<
[
'
json
'
,
...
DownloadFormat
[]]
>
)
=>
z
.
object
({
z
.
object
({
...
...
This diff is collapsed.
Click to expand it.
packages/api/src/index.ts
+
5
−
2
View file @
0378f8e9
...
@@ -30,7 +30,7 @@ import { userLoader } from './server/user-loader.js'
...
@@ -30,7 +30,7 @@ import { userLoader } from './server/user-loader.js'
import
{
connectedCatcher
}
from
'
./server/connected-catcher.js
'
import
{
connectedCatcher
}
from
'
./server/connected-catcher.js
'
import
cookieParser
from
'
cookie-parser
'
import
cookieParser
from
'
cookie-parser
'
import
pg
from
'
pg
'
import
pg
from
'
pg
'
import
qs
from
'
qs
'
// Le pool ne doit être qu'aux entrypoints : le daily, le monthly, et l'application.
// Le pool ne doit être qu'aux entrypoints : le daily, le monthly, et l'application.
const
pool
=
new
pg
.
Pool
({
const
pool
=
new
pg
.
Pool
({
host
:
process
.
env
.
PGHOST
,
host
:
process
.
env
.
PGHOST
,
...
@@ -46,7 +46,9 @@ filesInit()
...
@@ -46,7 +46,9 @@ filesInit()
databaseInit
(
pool
).
then
(()
=>
{
databaseInit
(
pool
).
then
(()
=>
{
const
app
=
express
()
const
app
=
express
()
app
.
disable
(
'
x-powered-by
'
)
app
.
disable
(
'
x-powered-by
'
)
app
.
set
(
'
query parser
'
,
function
(
str
:
string
)
{
return
qs
.
parse
(
str
,
{
comma
:
true
})
})
if
(
process
.
env
.
API_SENTRY_URL
)
{
if
(
process
.
env
.
API_SENTRY_URL
)
{
Sentry
.
init
({
Sentry
.
init
({
dsn
:
process
.
env
.
API_SENTRY_URL
,
dsn
:
process
.
env
.
API_SENTRY_URL
,
...
@@ -81,6 +83,7 @@ databaseInit(pool).then(() => {
...
@@ -81,6 +83,7 @@ databaseInit(pool).then(() => {
res
.
write
(
`data:
${
process
.
env
.
APPLICATION_VERSION
}
\n\n`
)
res
.
write
(
`data:
${
process
.
env
.
APPLICATION_VERSION
}
\n\n`
)
res
.
flush
()
res
.
flush
()
})
})
app
.
use
(
express
.
urlencoded
({
extended
:
true
}),
express
.
json
({
limit
:
'
5mb
'
}),
restWithPool
(
pool
))
app
.
use
(
express
.
urlencoded
({
extended
:
true
}),
express
.
json
({
limit
:
'
5mb
'
}),
restWithPool
(
pool
))
app
.
use
(
'
/televersement
'
,
uploadAllowedMiddleware
,
restUpload
())
app
.
use
(
'
/televersement
'
,
uploadAllowedMiddleware
,
restUpload
())
...
...
This diff is collapsed.
Click to expand it.
packages/api/tests/app.ts
+
4
−
1
View file @
0378f8e9
...
@@ -4,10 +4,13 @@ import { graphql } from '../src/server/graphql.js'
...
@@ -4,10 +4,13 @@ import { graphql } from '../src/server/graphql.js'
import
{
authJwt
}
from
'
../src/server/auth-jwt.js
'
import
{
authJwt
}
from
'
../src/server/auth-jwt.js
'
import
{
restUpload
,
uploadAllowedMiddleware
}
from
'
../src/server/upload.js
'
import
{
restUpload
,
uploadAllowedMiddleware
}
from
'
../src/server/upload.js
'
import
{
restWithPool
}
from
'
../src/server/rest.js
'
import
{
restWithPool
}
from
'
../src/server/rest.js
'
import
qs
from
'
qs
'
export
const
app
=
(
dbPool
:
Pool
)
=>
{
export
const
app
=
(
dbPool
:
Pool
)
=>
{
const
app
=
express
()
const
app
=
express
()
app
.
disable
(
'
x-powered-by
'
)
app
.
disable
(
'
x-powered-by
'
)
app
.
set
(
'
query parser
'
,
function
(
str
:
string
)
{
return
qs
.
parse
(
str
,
{
comma
:
true
})
})
app
.
use
(
authJwt
)
app
.
use
(
authJwt
)
app
.
use
(
express
.
urlencoded
({
extended
:
true
}),
express
.
json
(),
restWithPool
(
dbPool
))
app
.
use
(
express
.
urlencoded
({
extended
:
true
}),
express
.
json
(),
restWithPool
(
dbPool
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment