diff --git a/.gitapp/.gitkeep b/.gitapp/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.gitapp/manifest.json b/.gitapp/manifest.json new file mode 100644 index 0000000..b51e6ff --- /dev/null +++ b/.gitapp/manifest.json @@ -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 + } +} \ No newline at end of file diff --git a/.gitapp/operations/.gitkeep b/.gitapp/operations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.gitapp/operations/create-record.yaml b/.gitapp/operations/create-record.yaml new file mode 100644 index 0000000..1037449 --- /dev/null +++ b/.gitapp/operations/create-record.yaml @@ -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" diff --git a/.gitapp/operations/delete-record.yaml b/.gitapp/operations/delete-record.yaml new file mode 100644 index 0000000..e2425c8 --- /dev/null +++ b/.gitapp/operations/delete-record.yaml @@ -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" diff --git a/.gitapp/operations/update-record.yaml b/.gitapp/operations/update-record.yaml new file mode 100644 index 0000000..bb9ece0 --- /dev/null +++ b/.gitapp/operations/update-record.yaml @@ -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" diff --git a/.gitapp/schemas/.gitkeep b/.gitapp/schemas/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.gitapp/schemas/cuisines.json b/.gitapp/schemas/cuisines.json new file mode 100644 index 0000000..41e4aef --- /dev/null +++ b/.gitapp/schemas/cuisines.json @@ -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" + } + } +} \ No newline at end of file diff --git a/.gitapp/schemas/ingredients.json b/.gitapp/schemas/ingredients.json new file mode 100644 index 0000000..3bea1e0 --- /dev/null +++ b/.gitapp/schemas/ingredients.json @@ -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" + } + } + } +} \ No newline at end of file diff --git a/.gitapp/schemas/recipes.json b/.gitapp/schemas/recipes.json new file mode 100644 index 0000000..1b90e9a --- /dev/null +++ b/.gitapp/schemas/recipes.json @@ -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 + } + } + } +} \ No newline at end of file diff --git a/.gitapp/schemas/tags.json b/.gitapp/schemas/tags.json new file mode 100644 index 0000000..ba5e9de --- /dev/null +++ b/.gitapp/schemas/tags.json @@ -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" + } + } +} \ No newline at end of file diff --git a/.gitapp/schemas/users.json b/.gitapp/schemas/users.json new file mode 100644 index 0000000..da45546 --- /dev/null +++ b/.gitapp/schemas/users.json @@ -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" + } + } +} \ No newline at end of file diff --git a/collections/cuisines/.gitkeep b/collections/cuisines/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/collections/ingredients/.gitkeep b/collections/ingredients/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/collections/recipes/.gitkeep b/collections/recipes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/collections/tags/.gitkeep b/collections/tags/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/collections/users/.gitkeep b/collections/users/.gitkeep new file mode 100644 index 0000000..e69de29