feat(templates): create schemas for cuisines, tags, users, recipes, ingredients
This commit is contained in:
parent
f6fd915a1b
commit
58a170d200
|
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
"name": "pocketbase-lite",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"paths": {
|
||||||
|
"data": "collections/",
|
||||||
|
"media": "media/",
|
||||||
|
"indexes": ".gitapp/indexes/"
|
||||||
|
},
|
||||||
|
"schemas": [
|
||||||
|
{
|
||||||
|
"id": "cuisines",
|
||||||
|
"file": "schemas/cuisines.json",
|
||||||
|
"glob": "collections/cuisines/*.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "tags",
|
||||||
|
"file": "schemas/tags.json",
|
||||||
|
"glob": "collections/tags/*.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "users",
|
||||||
|
"file": "schemas/users.json",
|
||||||
|
"glob": "collections/users/*.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "recipes",
|
||||||
|
"file": "schemas/recipes.json",
|
||||||
|
"glob": "collections/recipes/*.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ingredients",
|
||||||
|
"file": "schemas/ingredients.json",
|
||||||
|
"glob": "collections/ingredients/*.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"operations": [
|
||||||
|
"create-record",
|
||||||
|
"update-record",
|
||||||
|
"delete-record"
|
||||||
|
],
|
||||||
|
"policies": {
|
||||||
|
"roles": [
|
||||||
|
"viewer",
|
||||||
|
"editor"
|
||||||
|
],
|
||||||
|
"acl": null
|
||||||
|
},
|
||||||
|
"lfs": {
|
||||||
|
"enabled": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
name: create-record
|
||||||
|
version: 1
|
||||||
|
scope:
|
||||||
|
subtree: "collections/"
|
||||||
|
input:
|
||||||
|
$schema: zod
|
||||||
|
schema: |
|
||||||
|
z.object({
|
||||||
|
collection: z.string().min(1),
|
||||||
|
id: z.string().min(1),
|
||||||
|
data: z.record(z.unknown())
|
||||||
|
})
|
||||||
|
preconditions: []
|
||||||
|
mutations:
|
||||||
|
- type: create_file
|
||||||
|
path: "collections/${input.collection}/${input.id}.json"
|
||||||
|
content: "${JSON.stringify(input.data, null, 2)}"
|
||||||
|
commit:
|
||||||
|
message: "feat(data): create ${input.collection} record ${input.id}"
|
||||||
|
updateRef: "refs/heads/main"
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
name: delete-record
|
||||||
|
version: 1
|
||||||
|
scope:
|
||||||
|
subtree: "collections/"
|
||||||
|
input:
|
||||||
|
$schema: zod
|
||||||
|
schema: |
|
||||||
|
z.object({
|
||||||
|
collection: z.string().min(1),
|
||||||
|
id: z.string().min(1)
|
||||||
|
})
|
||||||
|
preconditions:
|
||||||
|
- type: path_exists
|
||||||
|
path: "collections/${input.collection}/${input.id}.json"
|
||||||
|
mutations:
|
||||||
|
- type: delete_file
|
||||||
|
path: "collections/${input.collection}/${input.id}.json"
|
||||||
|
commit:
|
||||||
|
message: "feat(data): delete ${input.collection} record ${input.id}"
|
||||||
|
updateRef: "refs/heads/main"
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
name: update-record
|
||||||
|
version: 1
|
||||||
|
scope:
|
||||||
|
subtree: "collections/"
|
||||||
|
input:
|
||||||
|
$schema: zod
|
||||||
|
schema: |
|
||||||
|
z.object({
|
||||||
|
collection: z.string().min(1),
|
||||||
|
id: z.string().min(1),
|
||||||
|
data: z.record(z.unknown())
|
||||||
|
})
|
||||||
|
preconditions:
|
||||||
|
- type: path_exists
|
||||||
|
path: "collections/${input.collection}/${input.id}.json"
|
||||||
|
mutations:
|
||||||
|
- type: create_file
|
||||||
|
path: "collections/${input.collection}/${input.id}.json"
|
||||||
|
content: "${JSON.stringify(input.data, null, 2)}"
|
||||||
|
commit:
|
||||||
|
message: "feat(data): update ${input.collection} record ${input.id}"
|
||||||
|
updateRef: "refs/heads/main"
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"$id": "cuisines",
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"region"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1
|
||||||
|
},
|
||||||
|
"region": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"flag": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"$id": "ingredients",
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"quantity"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1
|
||||||
|
},
|
||||||
|
"quantity": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"unit": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"notes": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"recipe": {
|
||||||
|
"type": "string",
|
||||||
|
"x-relation": {
|
||||||
|
"collection": "recipes",
|
||||||
|
"type": "single"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"$id": "recipes",
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"title",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"title": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"prepTime": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"cookTime": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"servings": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1
|
||||||
|
},
|
||||||
|
"image": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"instructions": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"difficulty": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"easy",
|
||||||
|
"medium",
|
||||||
|
"hard"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"type": "string",
|
||||||
|
"x-relation": {
|
||||||
|
"collection": "users",
|
||||||
|
"type": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cuisine": {
|
||||||
|
"type": "string",
|
||||||
|
"x-relation": {
|
||||||
|
"collection": "cuisines",
|
||||||
|
"type": "single"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"x-relation": {
|
||||||
|
"collection": "tags",
|
||||||
|
"type": "multiple",
|
||||||
|
"maxItems": 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"$id": "tags",
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1
|
||||||
|
},
|
||||||
|
"color": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"$id": "users",
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1
|
||||||
|
},
|
||||||
|
"bio": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"avatar": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue