Skip to content

Commit

Permalink
Added bal schema to address, common toponym and district meta schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineludeau committed Oct 6, 2023
1 parent e8d55c0 commit 1b39619
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
5 changes: 3 additions & 2 deletions lib/api/address/schema.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {object, string, number, boolean, array, date} from 'yup'
import {banID, geometrySchema, labelSchema, cadastreSchema} from '../schema.js'
import {banID, geometrySchema, labelSchema, cadastreSchema, balSchema} from '../schema.js'

const PositionTypes = ['entrance', 'building', 'staircase identifier', 'unit identifier', 'utility service', 'postal delivery', 'parcel', 'segment', 'other']

Expand All @@ -9,7 +9,8 @@ const positionSchema = object({
})

const metaSchema = object({
cadastre: cadastreSchema
cadastre: cadastreSchema,
bal: balSchema,
})

export const banAddressSchema = object({
Expand Down
5 changes: 3 additions & 2 deletions lib/api/common-toponym/schema.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {object, array, date} from 'yup'
import {banID, geometrySchema, labelSchema, cadastreSchema} from '../schema.js'
import {banID, geometrySchema, labelSchema, cadastreSchema, balSchema} from '../schema.js'

const metaSchema = object({
cadastre: cadastreSchema
cadastre: cadastreSchema,
bal: balSchema,
})

export const banCommonToponymSchema = object({
Expand Down
5 changes: 3 additions & 2 deletions lib/api/district/schema.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import {object, array, date, bool} from 'yup'
import {banID, labelSchema, inseeSchema} from '../schema.js'
import {banID, labelSchema, inseeSchema, balSchema} from '../schema.js'

const configSchema = object({
useBanId: bool()
})

const metaSchema = object({
insee: inseeSchema
insee: inseeSchema,
bal: balSchema,
})

export const banDistrictSchema = object({
Expand Down
11 changes: 10 additions & 1 deletion lib/api/schema.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {object, string, number, array} from 'yup'
import {object, string, number, array, date, boolean} from 'yup'

export const banID = string().trim().uuid()

Expand All @@ -19,3 +19,12 @@ export const inseeSchema = object({
export const cadastreSchema = object({
ids: array().of(string().trim())
})

export const balSchema = object({
idRevision: string().trim(),
dateRevision: date(),
codeAncienneCommune: string().trim(),
nomAncienneCommune: string().trim(),
isLieuDit: boolean()
})

0 comments on commit 1b39619

Please sign in to comment.