Skip to content

Commit

Permalink
Store Validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Dec 22, 2024
1 parent 7883840 commit 51ef73c
Show file tree
Hide file tree
Showing 5 changed files with 2,752 additions and 218 deletions.
6 changes: 6 additions & 0 deletions api/routes/basemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ export default async function router(schema: Schema, config: Config) {
type: Type.Optional(Type.Enum(Basemap_Type)),
sort: Type.String({ default: 'created', enum: Object.keys(Basemap) }),
filter: Default.Filter,
group: Type.Optional(Type.String({
description: 'Only show Basemaps belonging to a given group'
})),
overlay: Type.Boolean({ default: false })
}),
res: Type.Object({
Expand All @@ -194,6 +197,7 @@ export default async function router(schema: Schema, config: Config) {
AND (${Param(req.query.overlay)}::BOOLEAN = overlay)
AND (username IS NULL OR username = ${user.email})
AND (${Param(req.query.type)}::TEXT IS NULL or ${Param(req.query.type)}::TEXT = type)
AND (${Param(req.query.group)}::TEXT IS NULL or ${Param(req.query.group)}::TEXT = 'group')
AND ${scope}
`
});
Expand All @@ -219,6 +223,7 @@ export default async function router(schema: Schema, config: Config) {
description: 'Register a new basemap',
body: Type.Object({
name: Default.NameField,
group: Type.Optional(Type.String()),
scope: Type.Enum(ResourceCreationScope, { default: ResourceCreationScope.USER }),
url: Type.String(),
overlay: Type.Boolean({ default: false }),
Expand Down Expand Up @@ -283,6 +288,7 @@ export default async function router(schema: Schema, config: Config) {
}),
body: Type.Object({
name: Type.Optional(Default.NameField),
group: Type.Optional(Type.Union([Type.Null(), Type.String()])),
url: Type.Optional(Type.String()),
minzoom: Type.Optional(Type.Integer()),
maxzoom: Type.Optional(Type.Integer()),
Expand Down
Loading

0 comments on commit 51ef73c

Please sign in to comment.