Skip to content

Commit 42f611f

Browse files
committed
Create new schema
1 parent ab79fce commit 42f611f

File tree

22 files changed

+571
-296
lines changed

22 files changed

+571
-296
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Headless CMS for [Garmeres](https://garmeres.com), built on [Strapi 5](https://strapi.io). Provides content APIs consumed by the website.
44

5-
- **Database:** SQLite, replicated to S3 via [Litestream](https://litestream.io)
5+
- **Database:** SQLite, backed up to S3 on a schedule
66
- **Media uploads:** Hetzner Object Storage (S3-compatible)
77
- **Runtime:** Node 20, deployed as a container on Kubernetes
88

config/plugins.ts

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
import type { Core } from "@strapi/strapi";
22

3-
const config = ({
4-
env,
5-
}: Core.Config.Shared.ConfigParams): Core.Config.Plugin => ({
6-
upload: {
7-
config: {
8-
provider: "aws-s3",
9-
providerOptions: {
10-
baseUrl: env("S3_CDN_URL", ""),
11-
s3Options: {
12-
credentials: {
13-
accessKeyId: env("S3_ACCESS_KEY_ID", ""),
14-
secretAccessKey: env("S3_SECRET_ACCESS_KEY", ""),
15-
},
16-
endpoint: env("S3_ENDPOINT", ""),
17-
region: env("S3_REGION", ""),
18-
forcePathStyle: true,
19-
params: {
20-
Bucket: env("S3_BUCKET", ""),
21-
},
3+
const s3Upload = (env: Core.Config.Shared.ConfigParams["env"]) => ({
4+
config: {
5+
provider: "aws-s3",
6+
providerOptions: {
7+
baseUrl: env("S3_CDN_URL", ""),
8+
s3Options: {
9+
credentials: {
10+
accessKeyId: env("S3_ACCESS_KEY_ID", ""),
11+
secretAccessKey: env("S3_SECRET_ACCESS_KEY", ""),
12+
},
13+
endpoint: env("S3_ENDPOINT", ""),
14+
region: env("S3_REGION", ""),
15+
forcePathStyle: true,
16+
params: {
17+
Bucket: env("S3_BUCKET", ""),
2218
},
2319
},
2420
},
2521
},
22+
});
23+
24+
const config = ({
25+
env,
26+
}: Core.Config.Shared.ConfigParams): Core.Config.Plugin => ({
27+
upload: env("NODE_ENV") === "production" ? s3Upload(env) : { config: {} },
2628
email: {
2729
config: {
2830
provider: "@strapi/provider-email-nodemailer",

config/server.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import type { Core } from '@strapi/strapi';
1+
import type { Core } from "@strapi/strapi";
22

3-
const config = ({ env }: Core.Config.Shared.ConfigParams): Core.Config.Server => ({
4-
host: env('HOST', '0.0.0.0'),
5-
port: env.int('PORT', 1337),
6-
url: env('PUBLIC_URL'),
7-
app: {
8-
keys: env.array('APP_KEYS'),
9-
},
3+
const config = ({
4+
env,
5+
}: Core.Config.Shared.ConfigParams): Core.Config.Server => ({
6+
host: env("HOST", "0.0.0.0"),
7+
port: env.int("PORT", 1337),
8+
url: env("PUBLIC_URL"),
9+
app: {
10+
keys: env.array("APP_KEYS"),
11+
},
1012
});
1113

1214
export default config;

src/api/blog-post/content-types/blog-post/schema.json

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,42 @@
1515
}
1616
},
1717
"attributes": {
18-
"Title": {
18+
"thumbnail": {
19+
"type": "media",
20+
"pluginOptions": {
21+
"i18n": {
22+
"localized": false
23+
}
24+
},
25+
"multiple": false,
26+
"allowedTypes": [
27+
"images",
28+
"files"
29+
]
30+
},
31+
"title": {
1932
"type": "string",
2033
"pluginOptions": {
2134
"i18n": {
2235
"localized": true
2336
}
2437
},
38+
"minLength": 3,
2539
"required": true,
2640
"unique": true
2741
},
28-
"Image": {
29-
"type": "relation",
30-
"relation": "oneToOne",
31-
"target": "api::image.image"
42+
"slug": {
43+
"type": "uid",
44+
"pluginOptions": {
45+
"i18n": {
46+
"localized": true
47+
}
48+
},
49+
"targetField": "title",
50+
"required": true,
51+
"minLength": 3
3252
},
33-
"Body": {
53+
"body": {
3454
"type": "blocks",
3555
"pluginOptions": {
3656
"i18n": {

src/api/contact/content-types/contact/schema.json

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,18 @@
99
"options": {
1010
"draftAndPublish": true
1111
},
12-
"pluginOptions": {
13-
"i18n": {
14-
"localized": false
15-
}
16-
},
12+
"pluginOptions": {},
1713
"attributes": {
1814
"OrganisationName": {
1915
"type": "string",
20-
"pluginOptions": {
21-
"i18n": {
22-
"localized": false
23-
}
24-
},
2516
"required": true
2617
},
2718
"OrganisationNumber": {
2819
"type": "string",
29-
"pluginOptions": {
30-
"i18n": {
31-
"localized": false
32-
}
33-
},
3420
"required": true
3521
},
3622
"Email": {
3723
"type": "email",
38-
"pluginOptions": {
39-
"i18n": {
40-
"localized": false
41-
}
42-
},
4324
"required": true,
4425
"default": "meile@garmeres.com"
4526
},
@@ -49,20 +30,10 @@
4930
},
5031
"Vipps": {
5132
"type": "string",
52-
"pluginOptions": {
53-
"i18n": {
54-
"localized": false
55-
}
56-
},
5733
"required": true
5834
},
5935
"AccountNumber": {
6036
"type": "string",
61-
"pluginOptions": {
62-
"i18n": {
63-
"localized": false
64-
}
65-
},
6637
"required": true
6738
},
6839
"IBAN": {
@@ -72,24 +43,6 @@
7243
"SWIFT": {
7344
"type": "string",
7445
"required": true
75-
},
76-
"FacebookURL": {
77-
"type": "string",
78-
"pluginOptions": {
79-
"i18n": {
80-
"localized": false
81-
}
82-
},
83-
"required": true
84-
},
85-
"InstagramURL": {
86-
"type": "string",
87-
"pluginOptions": {
88-
"i18n": {
89-
"localized": false
90-
}
91-
},
92-
"required": true
9346
}
9447
}
9548
}

src/api/home-page/content-types/home-page/schema.json

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,38 @@
1515
}
1616
},
1717
"attributes": {
18-
"BannerImage": {
18+
"name": {
19+
"type": "string",
20+
"pluginOptions": {
21+
"i18n": {
22+
"localized": true
23+
}
24+
},
25+
"default": "Home",
26+
"required": true,
27+
"unique": true
28+
},
29+
"title": {
30+
"type": "string",
31+
"pluginOptions": {
32+
"i18n": {
33+
"localized": true
34+
}
35+
},
36+
"default": "Home",
37+
"required": true,
38+
"unique": true
39+
},
40+
"subtitle": {
41+
"type": "text",
42+
"pluginOptions": {
43+
"i18n": {
44+
"localized": true
45+
}
46+
},
47+
"required": true
48+
},
49+
"bannerImage": {
1950
"type": "media",
2051
"pluginOptions": {
2152
"i18n": {
@@ -29,36 +60,34 @@
2960
"files"
3061
]
3162
},
32-
"BannerSubtitle": {
33-
"type": "text",
63+
"bannerButtonText": {
64+
"type": "string",
3465
"pluginOptions": {
3566
"i18n": {
3667
"localized": true
3768
}
3869
},
3970
"required": true
4071
},
41-
"BannerButtonLinkPage": {
72+
"bannerButtonLink": {
4273
"type": "relation",
4374
"relation": "oneToOne",
4475
"target": "api::page.page"
4576
},
46-
"BannerButtonLinkText": {
47-
"type": "string",
77+
"body": {
78+
"type": "dynamiczone",
4879
"pluginOptions": {
4980
"i18n": {
5081
"localized": true
5182
}
5283
},
53-
"required": true
54-
},
55-
"Body": {
56-
"type": "blocks",
57-
"pluginOptions": {
58-
"i18n": {
59-
"localized": true
60-
}
61-
}
84+
"components": [
85+
"content.rich-text",
86+
"content.membership-registration-form",
87+
"content.calendar",
88+
"content.blog-posts",
89+
"content.heading"
90+
]
6291
}
6392
}
6493
}

src/api/image/content-types/image/schema.json

Lines changed: 0 additions & 61 deletions
This file was deleted.

src/api/image/controllers/image.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/api/image/routes/image.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/api/image/services/image.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)