Skip to content

Commit 6aabd06

Browse files
authored
Merge pull request #4 from tespkg/api-documentation
Contains all changes
2 parents 62bde86 + f683261 commit 6aabd06

26 files changed

+3010
-2
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ coverage.out
1212
# plaintask todo files
1313
*.todo
1414

15+
# application specific ignores and go build outputs
16+
volumes/*
17+
pb_migrations/*
18+
pb_data/*
19+
server
20+
*.exe
21+
1522
# generated markdown previews
1623
README.html
1724
CHANGELOG.html

Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM golang:1.22 as builder
2+
3+
WORKDIR /user/src/app
4+
5+
COPY go.mod go.sum ./
6+
7+
RUN go mod download
8+
9+
COPY . .
10+
11+
RUN go build -v -o ./base ./examples/base/main.go
12+
13+
EXPOSE 8090
14+
15+
CMD [ "./base", "serve", "--http=0.0.0.0:8090"]

cms-api.md

+1,123
Large diffs are not rendered by default.

db_init.sql

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CREATE DATABASE pocketbase_db;
2+
CREATE DATABASE pocketbase_logs;

docker-compose-mafwr.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '3'
2+
services:
3+
postgres:
4+
image: postgres:latest
5+
ports:
6+
- 5432:5432
7+
environment:
8+
- POSTGRES_USER=postgres
9+
- POSTGRES_PASSWORD=postgres
10+
volumes:
11+
- postgres_data:/var/lib/postgresql/data
12+
- ./db_init.sql:/docker-entrypoint-initdb.d/db_init.sql
13+
healthcheck:
14+
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
15+
interval: 5s
16+
timeout: 5s
17+
retries: 5
18+
19+
pocketbase:
20+
build: .
21+
ports:
22+
- 8090:8090
23+
depends_on:
24+
postgres:
25+
condition: service_healthy
26+
environment:
27+
- LOGS_DATABASE=postgresql://postgres:postgres@postgres:5432/pocketbase_logs?sslmode=disable
28+
- DATABASE=postgresql://postgres:postgres@postgres:5432/pocketbase_db?sslmode=disable
29+
volumes:
30+
- ./examples/base/pb_migrations_mafwr_cms:/user/src/app/pb_migrations
31+
32+
volumes:
33+
postgres_data:

docker-compose.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '3'
2+
services:
3+
postgres:
4+
image: postgres:latest
5+
ports:
6+
- 5432:5432
7+
environment:
8+
- POSTGRES_USER=postgres
9+
- POSTGRES_PASSWORD=postgres
10+
volumes:
11+
- postgres_data:/var/lib/postgresql/data
12+
- ./db_init.sql:/docker-entrypoint-initdb.d/db_init.sql
13+
healthcheck:
14+
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
15+
interval: 5s
16+
timeout: 5s
17+
retries: 5
18+
19+
pocketbase:
20+
build: .
21+
ports:
22+
- 8090:8090
23+
depends_on:
24+
postgres:
25+
condition: service_healthy
26+
environment:
27+
- LOGS_DATABASE=postgresql://postgres:postgres@postgres:5432/pocketbase_logs?sslmode=disable
28+
- DATABASE=postgresql://postgres:postgres@postgres:5432/pocketbase_db?sslmode=disable
29+
volumes:
30+
- ./examples/base/pb_migrations:/user/src/app/pb_migrations
31+
32+
volumes:
33+
postgres_data:

examples/base/.env

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
LOGS_DATABASE="postgresql://postgres:postgres@localhost:5432/pocketbase_logs?sslmode=disable"
2+
DATABASE="postgresql://postgres:postgres@localhost:5432/pocketbase_db?sslmode=disable"

examples/base/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33

44
# exclude from the ignore filter
55
!.gitignore
6-
!main.go
6+
!pb_migrations_mafwr_cms
7+
!main.go
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/// <reference path="../pb_data/types.d.ts" />
2+
migrate((db) => {
3+
const collection = new Collection({
4+
"id": "7l3df7dfab5pbor",
5+
"created": "2024-09-02 13:44:50.980Z",
6+
"updated": "2024-09-02 13:44:50.980Z",
7+
"name": "about",
8+
"type": "base",
9+
"system": false,
10+
"schema": [
11+
{
12+
"system": false,
13+
"id": "cm4srdjl",
14+
"name": "title_en",
15+
"type": "text",
16+
"required": false,
17+
"presentable": false,
18+
"unique": false,
19+
"options": {
20+
"min": null,
21+
"max": null,
22+
"pattern": ""
23+
}
24+
},
25+
{
26+
"system": false,
27+
"id": "xp35aouv",
28+
"name": "vision_en",
29+
"type": "text",
30+
"required": false,
31+
"presentable": false,
32+
"unique": false,
33+
"options": {
34+
"min": null,
35+
"max": null,
36+
"pattern": ""
37+
}
38+
},
39+
{
40+
"system": false,
41+
"id": "yccb0lah",
42+
"name": "mission_en",
43+
"type": "text",
44+
"required": false,
45+
"presentable": false,
46+
"unique": false,
47+
"options": {
48+
"min": null,
49+
"max": null,
50+
"pattern": ""
51+
}
52+
},
53+
{
54+
"system": false,
55+
"id": "isspbmyd",
56+
"name": "title_ar",
57+
"type": "text",
58+
"required": false,
59+
"presentable": false,
60+
"unique": false,
61+
"options": {
62+
"min": null,
63+
"max": null,
64+
"pattern": ""
65+
}
66+
},
67+
{
68+
"system": false,
69+
"id": "cuvgeila",
70+
"name": "vision_ar",
71+
"type": "text",
72+
"required": false,
73+
"presentable": false,
74+
"unique": false,
75+
"options": {
76+
"min": null,
77+
"max": null,
78+
"pattern": ""
79+
}
80+
},
81+
{
82+
"system": false,
83+
"id": "kiabillv",
84+
"name": "mission_ar",
85+
"type": "text",
86+
"required": false,
87+
"presentable": false,
88+
"unique": false,
89+
"options": {
90+
"min": null,
91+
"max": null,
92+
"pattern": ""
93+
}
94+
}
95+
],
96+
"indexes": [],
97+
"listRule": "",
98+
"viewRule": "",
99+
"createRule": "@request.auth.id != ''",
100+
"updateRule": "@request.auth.id != ''",
101+
"deleteRule": "@request.auth.id != ''",
102+
"options": {}
103+
});
104+
105+
return Dao(db).saveCollection(collection);
106+
}, (db) => {
107+
const dao = new Dao(db);
108+
const collection = dao.findCollectionByNameOrId("7l3df7dfab5pbor");
109+
110+
return dao.deleteCollection(collection);
111+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/// <reference path="../pb_data/types.d.ts" />
2+
migrate((db) => {
3+
const collection = new Collection({
4+
"id": "z9qut6efyilfspl",
5+
"created": "2024-09-04 08:16:25.101Z",
6+
"updated": "2024-09-04 08:16:25.101Z",
7+
"name": "specializations",
8+
"type": "base",
9+
"system": false,
10+
"schema": [
11+
{
12+
"system": false,
13+
"id": "gov8ws8e",
14+
"name": "title_en",
15+
"type": "text",
16+
"required": false,
17+
"presentable": false,
18+
"unique": false,
19+
"options": {
20+
"min": null,
21+
"max": null,
22+
"pattern": ""
23+
}
24+
},
25+
{
26+
"system": false,
27+
"id": "hslis2lz",
28+
"name": "description_en",
29+
"type": "text",
30+
"required": false,
31+
"presentable": false,
32+
"unique": false,
33+
"options": {
34+
"min": null,
35+
"max": null,
36+
"pattern": ""
37+
}
38+
},
39+
{
40+
"system": false,
41+
"id": "0kgz50op",
42+
"name": "title_ar",
43+
"type": "text",
44+
"required": false,
45+
"presentable": false,
46+
"unique": false,
47+
"options": {
48+
"min": null,
49+
"max": null,
50+
"pattern": ""
51+
}
52+
},
53+
{
54+
"system": false,
55+
"id": "q4v9kmii",
56+
"name": "description_ar",
57+
"type": "text",
58+
"required": false,
59+
"presentable": false,
60+
"unique": false,
61+
"options": {
62+
"min": null,
63+
"max": null,
64+
"pattern": ""
65+
}
66+
},
67+
{
68+
"system": false,
69+
"id": "bib1yfsh",
70+
"name": "images",
71+
"type": "relation",
72+
"required": false,
73+
"presentable": false,
74+
"unique": false,
75+
"options": {
76+
"collectionId": "1bp57azl51u4zmw",
77+
"cascadeDelete": true,
78+
"minSelect": null,
79+
"maxSelect": null,
80+
"displayFields": null
81+
}
82+
},
83+
{
84+
"system": false,
85+
"id": "jdz3gz4i",
86+
"name": "attachments",
87+
"type": "relation",
88+
"required": false,
89+
"presentable": false,
90+
"unique": false,
91+
"options": {
92+
"collectionId": "1bp57azl51u4zmw",
93+
"cascadeDelete": true,
94+
"minSelect": null,
95+
"maxSelect": null,
96+
"displayFields": null
97+
}
98+
}
99+
],
100+
"indexes": [],
101+
"listRule": "",
102+
"viewRule": "",
103+
"createRule": "@request.auth.id != ''",
104+
"updateRule": "@request.auth.id != ''",
105+
"deleteRule": "@request.auth.id != ''",
106+
"options": {}
107+
});
108+
109+
return Dao(db).saveCollection(collection);
110+
}, (db) => {
111+
const dao = new Dao(db);
112+
const collection = dao.findCollectionByNameOrId("z9qut6efyilfspl");
113+
114+
return dao.deleteCollection(collection);
115+
})

0 commit comments

Comments
 (0)