[PIE-28] Switch to type-safe API #12
40
src/data/schema.ts
Normal file
40
src/data/schema.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
// Base PB type
|
||||||
|
export interface BaseRecord {
|
||||||
|
id: string,
|
||||||
|
created: string,
|
||||||
|
updated: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Ingredient extends BaseRecord {
|
||||||
|
quantity: string,
|
||||||
|
unit: string,
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Step extends BaseRecord {
|
||||||
|
index: number,
|
||||||
|
instruction: string,
|
||||||
|
ingredients?: Ingredient[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Tag extends BaseRecord {
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// not sure Image is the best type cos it might be quite heavy to get all the fields every time but
|
||||||
|
// it is here in case it is (a good idea)
|
||||||
|
export interface Image extends BaseRecord {
|
||||||
|
url: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Recipe extends BaseRecord {
|
||||||
|
name: string,
|
||||||
|
description?: string,
|
||||||
|
servings?: number,
|
||||||
|
images?: string[], // image IDs
|
||||||
|
steps: Step[],
|
||||||
|
tags?: Tag[]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user