feat(templates): create schemas for tags, folders, albums, media
This commit is contained in:
parent
8c0380be54
commit
cf8d9472ca
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"name": "pocketbase-lite",
|
||||
"version": "0.1.0",
|
||||
"paths": {
|
||||
"data": "collections/",
|
||||
"media": "media/",
|
||||
"indexes": ".gitapp/indexes/"
|
||||
},
|
||||
"schemas": [
|
||||
{
|
||||
"id": "tags",
|
||||
"file": "schemas/tags.json",
|
||||
"glob": "collections/tags/*.json"
|
||||
},
|
||||
{
|
||||
"id": "folders",
|
||||
"file": "schemas/folders.json",
|
||||
"glob": "collections/folders/*.json"
|
||||
},
|
||||
{
|
||||
"id": "albums",
|
||||
"file": "schemas/albums.json",
|
||||
"glob": "collections/albums/*.json"
|
||||
},
|
||||
{
|
||||
"id": "media",
|
||||
"file": "schemas/media.json",
|
||||
"glob": "collections/media/*.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,21 @@
|
|||
{
|
||||
"$id": "albums",
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"coverImage": {
|
||||
"type": "string",
|
||||
"description": "URL or path to cover image"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"$id": "folders",
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"parent": {
|
||||
"type": "string",
|
||||
"x-relation": {
|
||||
"collection": "folders",
|
||||
"type": "single"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
{
|
||||
"$id": "media",
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"title"
|
||||
],
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"file": {
|
||||
"type": "object",
|
||||
"description": "File metadata (path, filename, mimeType, size)",
|
||||
"x-file": {
|
||||
"maxSize": 10485760,
|
||||
"mimeTypes": [
|
||||
"image/jpeg",
|
||||
"image/png",
|
||||
"image/webp",
|
||||
"image/gif"
|
||||
]
|
||||
}
|
||||
},
|
||||
"width": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"description": "Image width in pixels"
|
||||
},
|
||||
"height": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"description": "Image height in pixels"
|
||||
},
|
||||
"format": {
|
||||
"type": "string",
|
||||
"description": "Image format (jpeg, png, webp, gif)"
|
||||
},
|
||||
"fileSize": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"description": "File size in bytes"
|
||||
},
|
||||
"folder": {
|
||||
"type": "string",
|
||||
"x-relation": {
|
||||
"collection": "folders",
|
||||
"type": "single"
|
||||
}
|
||||
},
|
||||
"albums": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-relation": {
|
||||
"collection": "albums",
|
||||
"type": "multiple",
|
||||
"maxItems": 10
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-relation": {
|
||||
"collection": "tags",
|
||||
"type": "multiple",
|
||||
"maxItems": 20
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"$id": "tags",
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"slug"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"color": {
|
||||
"type": "string",
|
||||
"description": "Hex color for UI badges"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue