feat(templates): create schemas for tags, companies, contacts, deals, activities

This commit is contained in:
GitApp 2025-12-19 16:00:54 +00:00
parent a4f163cef2
commit aaae452aad
17 changed files with 316 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": "tags",
"file": "schemas/tags.json",
"glob": "collections/tags/*.json"
},
{
"id": "companies",
"file": "schemas/companies.json",
"glob": "collections/companies/*.json"
},
{
"id": "contacts",
"file": "schemas/contacts.json",
"glob": "collections/contacts/*.json"
},
{
"id": "deals",
"file": "schemas/deals.json",
"glob": "collections/deals/*.json"
},
{
"id": "activities",
"file": "schemas/activities.json",
"glob": "collections/activities/*.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

View File

@ -0,0 +1,50 @@
{
"$id": "activities",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": [
"type",
"subject",
"date"
],
"properties": {
"type": {
"type": "string",
"enum": [
"call",
"email",
"meeting",
"note",
"task"
]
},
"subject": {
"type": "string",
"minLength": 1
},
"notes": {
"type": "string"
},
"date": {
"type": "string",
"format": "date-time"
},
"completed": {
"type": "boolean"
},
"contact": {
"type": "string",
"x-relation": {
"collection": "contacts",
"type": "single"
}
},
"deal": {
"type": "string",
"x-relation": {
"collection": "deals",
"type": "single"
}
}
}
}

View File

@ -0,0 +1,41 @@
{
"$id": "companies",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": [
"name",
"industry"
],
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"industry": {
"type": "string"
},
"size": {
"type": "string",
"enum": [
"1-10",
"11-50",
"51-200",
"201-500",
"500+"
]
},
"website": {
"type": "string",
"format": "uri"
},
"logo": {
"type": "string"
},
"revenue": {
"type": "string"
},
"description": {
"type": "string"
}
}
}

View File

@ -0,0 +1,38 @@
{
"$id": "contacts",
"$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"
},
"title": {
"type": "string"
},
"avatar": {
"type": "string"
},
"notes": {
"type": "string"
},
"company": {
"type": "string",
"x-relation": {
"collection": "companies",
"type": "single"
}
}
}
}

View File

@ -0,0 +1,57 @@
{
"$id": "deals",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": [
"title",
"value",
"stage"
],
"properties": {
"title": {
"type": "string",
"minLength": 1
},
"value": {
"type": "number",
"minimum": 0
},
"stage": {
"type": "string",
"enum": [
"lead",
"qualified",
"proposal",
"negotiation",
"won",
"lost"
]
},
"probability": {
"type": "number",
"minimum": 0,
"maximum": 100
},
"closeDate": {
"type": "string",
"format": "date"
},
"notes": {
"type": "string"
},
"contact": {
"type": "string",
"x-relation": {
"collection": "contacts",
"type": "single"
}
},
"company": {
"type": "string",
"x-relation": {
"collection": "companies",
"type": "single"
}
}
}
}

17
.gitapp/schemas/tags.json Normal file
View File

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

View File

View File

View File

View File

View File