-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow turning off pages from Payload (#266)
* feat: allow turning off pages from Payload * fix: cms startup in e2e setup * fix: use healthchecks and stuff to order startups * fix: playwright serving report on fail * fix: mock discord in e2e * fix: allow reading features logged out * fix: missing / wrong env variables on e2e setup * fix: logout in dev * chore: unify package name in e2e * fix: revert hardcoded image in e2e setup * fix: lint scripts * fix: add missing migration
- Loading branch information
geisterfurz007
authored
Jan 7, 2024
1 parent
3a78aaf
commit 3cbe281
Showing
29 changed files
with
869 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,10 @@ services: | |
POSTGRES_USER: ytfe2e | ||
POSTGRES_PASSWORD: ytfe2e | ||
POSTGRES_DB: ytfe2e | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -d ytfe2e"] | ||
start_period: 2s | ||
interval: 1s | ||
|
||
server: | ||
image: ghcr.io/yes-theory-fam/yestheory-family-server:COMMIT_HASH | ||
|
@@ -22,14 +26,20 @@ services: | |
DISCORD_BOT_TOKEN: skipped | ||
DISCORD_TARGET_GUILD: skipped | ||
|
||
DISCORD_ADMIN_ID: skipped | ||
YESBOT_API_TOKEN: yesbot-api-token | ||
|
||
DISCORD_CLIENT_ID: skipped | ||
DISCORD_CLIENT_SECRET: skipped | ||
DISCORD_SCOPES: skipped | ||
|
||
CMS_ENDPOINT: "http://cms:3001/api/graphql" | ||
CMS_API_KEY: e2e-api-key | ||
depends_on: | ||
- cms | ||
- postgres | ||
cms: | ||
condition: 'service_healthy' | ||
postgres: | ||
condition: 'service_healthy' | ||
|
||
web: | ||
image: ghcr.io/yes-theory-fam/yestheory-family-web:COMMIT_HASH | ||
|
@@ -44,19 +54,28 @@ services: | |
cms: | ||
image: ghcr.io/yes-theory-fam/yestheory-family-cms:COMMIT_HASH | ||
environment: | ||
DATABASE_URI: "postgresql://ytfe2e:ytfe2e@postgres:5432/payload?schema=public" | ||
ENABLE_DATASEEDER: "true" | ||
PAYLOAD_SECRET: asdfghjkl | ||
INITIAL_ADMIN_MAIL: [email protected] | ||
INITIAL_ADMIN_PASSWORD: example | ||
DATABASE_URI: "postgresql://ytfe2e:ytfe2e@postgres:5432/payload?schema=public" | ||
TYPESENSE_API_KEY: 1234567890 | ||
TYPESENSE_API_URL: http://typesense:8108 | ||
SERVER_URL: http://localhost:3001 | ||
FRONTEND_URL: http://web:3000 | ||
BACKEND_URL: http://server:5000 | ||
INTERNAL_BACKEND_URL: http://server:5001 | ||
YESBOT_API_AUTH_TOKEN: yesbot-api-token | ||
INITIAL_ADMIN_ID: skipped | ||
PAYLOAD_API_KEY: e2e-api-key | ||
healthcheck: | ||
test: ["CMD-SHELL", "curl --silent --fail http://localhost:3001/admin > /dev/null || exit 1"] | ||
start_period: 5s | ||
interval: 1s | ||
retries: 10 | ||
ports: | ||
- "3001:3001" | ||
depends_on: | ||
- typesense | ||
postgres: | ||
condition: 'service_healthy' | ||
typesense: | ||
condition: 'service_started' | ||
|
||
typesense: | ||
image: typesense/typesense:0.25.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/usr/bin/env sh | ||
|
||
node node_modules/.bin/payload migrate | ||
|
||
if [ "$ENABLE_DATASEEDER" = "true" ]; then node ./packages/cms/dist/dataseeder/main.js ; fi | ||
|
||
node node_modules/.bin/payload migrate | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {type User} from 'payload/auth'; | ||
import {type SessionUser} from '../collections/users'; | ||
|
||
export const hiddenUnlessOwner = ({user}: {user: User}) => { | ||
const sessionUser = user as unknown as SessionUser; | ||
const roles = | ||
'roles' in sessionUser ? sessionUser.roles : sessionUser.user.roles; | ||
|
||
return !roles.includes('owner'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {type CollectionConfig} from 'payload/types'; | ||
import {hiddenUnlessOwner} from '../access/hidden-unless-owner'; | ||
import {requireOneOf} from '../access/require-one-of'; | ||
|
||
export const Features: CollectionConfig = { | ||
slug: 'feature', | ||
access: { | ||
read: () => true, | ||
create: requireOneOf(), | ||
update: requireOneOf(), | ||
delete: requireOneOf(), | ||
}, | ||
admin: { | ||
useAsTitle: 'name', | ||
hidden: hiddenUnlessOwner, | ||
}, | ||
fields: [ | ||
{ | ||
name: 'name', | ||
type: 'text', | ||
required: true, | ||
}, | ||
{ | ||
name: 'pathPrefix', | ||
type: 'text', | ||
required: true, | ||
}, | ||
{ | ||
name: 'navPath', | ||
type: 'text', | ||
hooks: { | ||
beforeValidate: [({value, data}) => value ?? data.pathPrefix], | ||
}, | ||
}, | ||
{ | ||
name: 'enabled', | ||
type: 'checkbox', | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.