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..3789341 --- /dev/null +++ b/.gitapp/manifest.json @@ -0,0 +1,61 @@ +{ + "name": "pocketbase-lite", + "version": "0.1.0", + "paths": { + "data": "collections/", + "media": "media/", + "indexes": ".gitapp/indexes/" + }, + "schemas": [ + { + "id": "categories", + "file": "schemas/categories.json", + "glob": "collections/categories/*.json" + }, + { + "id": "brands", + "file": "schemas/brands.json", + "glob": "collections/brands/*.json" + }, + { + "id": "products", + "file": "schemas/products.json", + "glob": "collections/products/*.json" + }, + { + "id": "customers", + "file": "schemas/customers.json", + "glob": "collections/customers/*.json" + }, + { + "id": "orders", + "file": "schemas/orders.json", + "glob": "collections/orders/*.json" + }, + { + "id": "order_items", + "file": "schemas/order_items.json", + "glob": "collections/order_items/*.json" + }, + { + "id": "reviews", + "file": "schemas/reviews.json", + "glob": "collections/reviews/*.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/brands.json b/.gitapp/schemas/brands.json new file mode 100644 index 0000000..d96c09a --- /dev/null +++ b/.gitapp/schemas/brands.json @@ -0,0 +1,24 @@ +{ + "$id": "brands", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "minLength": 1 + }, + "logo": { + "type": "string" + }, + "description": { + "type": "string" + }, + "website": { + "type": "string", + "format": "uri" + } + } +} \ No newline at end of file diff --git a/.gitapp/schemas/categories.json b/.gitapp/schemas/categories.json new file mode 100644 index 0000000..eb4b30b --- /dev/null +++ b/.gitapp/schemas/categories.json @@ -0,0 +1,31 @@ +{ + "$id": "categories", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "required": [ + "name", + "slug" + ], + "properties": { + "name": { + "type": "string", + "minLength": 1 + }, + "slug": { + "type": "string" + }, + "description": { + "type": "string" + }, + "image": { + "type": "string" + }, + "parent": { + "type": "string", + "x-relation": { + "collection": "categories", + "type": "single" + } + } + } +} \ No newline at end of file diff --git a/.gitapp/schemas/customers.json b/.gitapp/schemas/customers.json new file mode 100644 index 0000000..64fe508 --- /dev/null +++ b/.gitapp/schemas/customers.json @@ -0,0 +1,28 @@ +{ + "$id": "customers", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "required": [ + "name", + "email" + ], + "properties": { + "name": { + "type": "string", + "minLength": 1 + }, + "email": { + "type": "string", + "format": "email" + }, + "phone": { + "type": "string" + }, + "address": { + "type": "string" + }, + "avatar": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/.gitapp/schemas/order_items.json b/.gitapp/schemas/order_items.json new file mode 100644 index 0000000..a1c1f0c --- /dev/null +++ b/.gitapp/schemas/order_items.json @@ -0,0 +1,33 @@ +{ + "$id": "order_items", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "required": [ + "quantity", + "price" + ], + "properties": { + "quantity": { + "type": "integer", + "minimum": 1 + }, + "price": { + "type": "number", + "minimum": 0 + }, + "order": { + "type": "string", + "x-relation": { + "collection": "orders", + "type": "single" + } + }, + "product": { + "type": "string", + "x-relation": { + "collection": "products", + "type": "single" + } + } + } +} \ No newline at end of file diff --git a/.gitapp/schemas/orders.json b/.gitapp/schemas/orders.json new file mode 100644 index 0000000..14bf496 --- /dev/null +++ b/.gitapp/schemas/orders.json @@ -0,0 +1,43 @@ +{ + "$id": "orders", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "required": [ + "orderNumber", + "status", + "total" + ], + "properties": { + "orderNumber": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "pending", + "processing", + "shipped", + "delivered", + "cancelled" + ] + }, + "total": { + "type": "number", + "minimum": 0 + }, + "date": { + "type": "string", + "format": "date-time" + }, + "shippingAddress": { + "type": "string" + }, + "customer": { + "type": "string", + "x-relation": { + "collection": "customers", + "type": "single" + } + } + } +} \ No newline at end of file diff --git a/.gitapp/schemas/products.json b/.gitapp/schemas/products.json new file mode 100644 index 0000000..f532ead --- /dev/null +++ b/.gitapp/schemas/products.json @@ -0,0 +1,50 @@ +{ + "$id": "products", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "required": [ + "name", + "price", + "sku" + ], + "properties": { + "name": { + "type": "string", + "minLength": 1 + }, + "description": { + "type": "string" + }, + "price": { + "type": "number", + "minimum": 0 + }, + "sku": { + "type": "string" + }, + "stock": { + "type": "integer", + "minimum": 0 + }, + "image": { + "type": "string" + }, + "featured": { + "type": "boolean" + }, + "category": { + "type": "string", + "x-relation": { + "collection": "categories", + "type": "single" + } + }, + "brand": { + "type": "string", + "x-relation": { + "collection": "brands", + "type": "single" + } + } + } +} \ No newline at end of file diff --git a/.gitapp/schemas/reviews.json b/.gitapp/schemas/reviews.json new file mode 100644 index 0000000..bc87f3f --- /dev/null +++ b/.gitapp/schemas/reviews.json @@ -0,0 +1,43 @@ +{ + "$id": "reviews", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "required": [ + "rating", + "title" + ], + "properties": { + "rating": { + "type": "integer", + "minimum": 1, + "maximum": 5 + }, + "title": { + "type": "string" + }, + "content": { + "type": "string" + }, + "date": { + "type": "string", + "format": "date-time" + }, + "verified": { + "type": "boolean" + }, + "product": { + "type": "string", + "x-relation": { + "collection": "products", + "type": "single" + } + }, + "customer": { + "type": "string", + "x-relation": { + "collection": "customers", + "type": "single" + } + } + } +} \ No newline at end of file diff --git a/collections/brands/.gitkeep b/collections/brands/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/collections/categories/.gitkeep b/collections/categories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/collections/customers/.gitkeep b/collections/customers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/collections/order_items/.gitkeep b/collections/order_items/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/collections/orders/.gitkeep b/collections/orders/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/collections/products/.gitkeep b/collections/products/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/collections/reviews/.gitkeep b/collections/reviews/.gitkeep new file mode 100644 index 0000000..e69de29