feat(templates): create schemas for genres, people, movies, cast, reviews

This commit is contained in:
GitApp 2025-12-19 16:02:44 +00:00
parent 23bb791cea
commit d4f4d73aef
17 changed files with 285 additions and 0 deletions

0
.gitapp/.gitkeep Normal file
View File

51
.gitapp/manifest.json Normal file
View File

@ -0,0 +1,51 @@
{
"name": "pocketbase-lite",
"version": "0.1.0",
"paths": {
"data": "collections/",
"media": "media/",
"indexes": ".gitapp/indexes/"
},
"schemas": [
{
"id": "genres",
"file": "schemas/genres.json",
"glob": "collections/genres/*.json"
},
{
"id": "people",
"file": "schemas/people.json",
"glob": "collections/people/*.json"
},
{
"id": "movies",
"file": "schemas/movies.json",
"glob": "collections/movies/*.json"
},
{
"id": "cast",
"file": "schemas/cast.json",
"glob": "collections/cast/*.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
}
}

View File

View File

@ -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"

View File

@ -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"

View File

@ -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
.gitapp/schemas/.gitkeep Normal file
View File

31
.gitapp/schemas/cast.json Normal file
View File

@ -0,0 +1,31 @@
{
"$id": "cast",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": [
"character"
],
"properties": {
"character": {
"type": "string"
},
"billing": {
"type": "integer",
"minimum": 1
},
"movie": {
"type": "string",
"x-relation": {
"collection": "movies",
"type": "single"
}
},
"actor": {
"type": "string",
"x-relation": {
"collection": "people",
"type": "single"
}
}
}
}

View File

@ -0,0 +1,21 @@
{
"$id": "genres",
"$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"
}
}
}

View File

@ -0,0 +1,56 @@
{
"$id": "movies",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": [
"title",
"year"
],
"properties": {
"title": {
"type": "string",
"minLength": 1
},
"year": {
"type": "integer",
"minimum": 1900,
"maximum": 2030
},
"runtime": {
"type": "integer",
"minimum": 1
},
"plot": {
"type": "string"
},
"poster": {
"type": "string"
},
"rating": {
"type": "number",
"minimum": 0,
"maximum": 10
},
"budget": {
"type": "string"
},
"director": {
"type": "string",
"x-relation": {
"collection": "people",
"type": "single"
}
},
"genres": {
"type": "array",
"items": {
"type": "string"
},
"x-relation": {
"collection": "genres",
"type": "multiple",
"maxItems": 5
}
}
}
}

View File

@ -0,0 +1,27 @@
{
"$id": "people",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"bio": {
"type": "string"
},
"birthDate": {
"type": "string",
"format": "date"
},
"photo": {
"type": "string"
},
"knownFor": {
"type": "string"
}
}
}

View File

@ -0,0 +1,37 @@
{
"$id": "reviews",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": [
"rating",
"content"
],
"properties": {
"rating": {
"type": "number",
"minimum": 1,
"maximum": 10
},
"content": {
"type": "string"
},
"date": {
"type": "string",
"format": "date-time"
},
"movie": {
"type": "string",
"x-relation": {
"collection": "movies",
"type": "single"
}
},
"author": {
"type": "string",
"x-relation": {
"collection": "people",
"type": "single"
}
}
}
}

View File

View File

View File

View File

View File