Skip to content

Commit 49e3292

Browse files
fix: Add space_ids to device resource (#265)
1 parent 1a8b97c commit 49e3292

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

src/lib/database/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ export interface DatabaseMethods {
201201
warnings?: Device["warnings"]
202202
created_at?: string
203203
custom_metadata?: Device["custom_metadata"]
204+
space_ids?: Device["space_ids"]
204205
}) => Device
205206
deleteDevice: (device_id: Device["device_id"]) => void
206207
updateDevice: (

src/lib/database/store.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ const initializer = immer<Database>((set, get) => ({
508508
can_remotely_lock: params.can_remotely_lock,
509509
can_remotely_unlock: params.can_remotely_unlock,
510510
can_program_online_access_codes: params.can_program_online_access_codes,
511+
space_ids: params.space_ids ?? [],
511512
}
512513

513514
set({

src/lib/zod/device.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ export const device = z
194194
),
195195
created_at: z.string(),
196196
custom_metadata,
197+
space_ids: z.array(z.string()),
197198
})
198199
.merge(
199200
schemas.device.pick({

src/route-types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,6 +2284,7 @@ export type Routes = {
22842284
custom_metadata: {
22852285
[x: string]: string | number | null | boolean
22862286
}
2287+
space_ids: string[]
22872288
can_remotely_lock?: boolean | undefined
22882289
can_remotely_unlock?: boolean | undefined
22892290
can_program_online_access_codes?: boolean | undefined
@@ -2554,6 +2555,7 @@ export type Routes = {
25542555
custom_metadata: {
25552556
[x: string]: string | number | null | boolean
25562557
}
2558+
space_ids: string[]
25572559
can_remotely_lock?: boolean | undefined
25582560
can_remotely_unlock?: boolean | undefined
25592561
can_program_online_access_codes?: boolean | undefined
@@ -3448,6 +3450,7 @@ export type Routes = {
34483450
custom_metadata: {
34493451
[x: string]: string | number | null | boolean
34503452
}
3453+
space_ids: string[]
34513454
can_remotely_lock?: boolean | undefined
34523455
can_remotely_unlock?: boolean | undefined
34533456
can_program_online_access_codes?: boolean | undefined
@@ -3674,6 +3677,7 @@ export type Routes = {
36743677
custom_metadata: {
36753678
[x: string]: string | number | null | boolean
36763679
}
3680+
space_ids: string[]
36773681
can_remotely_lock?: boolean | undefined
36783682
can_remotely_unlock?: boolean | undefined
36793683
can_program_online_access_codes?: boolean | undefined
@@ -3944,6 +3948,7 @@ export type Routes = {
39443948
custom_metadata: {
39453949
[x: string]: string | number | null | boolean
39463950
}
3951+
space_ids: string[]
39473952
can_remotely_lock?: boolean | undefined
39483953
can_remotely_unlock?: boolean | undefined
39493954
can_program_online_access_codes?: boolean | undefined
@@ -4170,6 +4175,7 @@ export type Routes = {
41704175
custom_metadata: {
41714176
[x: string]: string | number | null | boolean
41724177
}
4178+
space_ids: string[]
41734179
can_remotely_lock?: boolean | undefined
41744180
can_remotely_unlock?: boolean | undefined
41754181
can_program_online_access_codes?: boolean | undefined
@@ -4909,6 +4915,7 @@ export type Routes = {
49094915
custom_metadata: {
49104916
[x: string]: string | number | null | boolean
49114917
}
4918+
space_ids: string[]
49124919
can_remotely_lock?: boolean | undefined
49134920
can_remotely_unlock?: boolean | undefined
49144921
can_program_online_access_codes?: boolean | undefined

test/api/devices/get.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ test("GET /devices/get with access token auth", async (t: ExecutionContext) => {
1818
})
1919

2020
t.is(device.device_id, seed.ws2.device1_id)
21+
t.truthy(device.space_ids)
2122
})

0 commit comments

Comments
 (0)