Signed-off-by: Max Schmidt <max.schmidt@outlook.de>
This commit is contained in:
Max Schmidt
2023-05-13 19:10:37 +02:00
parent 43fc0a402c
commit 0dfad4431f
14 changed files with 136 additions and 52 deletions

27
payload/Dockerfile Normal file
View File

@ -0,0 +1,27 @@
FROM node:lts-alpine as base
WORKDIR /base
COPY ./package.json ./package.json
RUN yarn install
COPY ./ ./
FROM base AS dev
ENV NODE_ENV=development
EXPOSE 3001
CMD ["yarn","dev"]
FROM base AS build
ENV NODE_ENV=production
WORKDIR /build
COPY --from=base /base ./
RUN yarn build
FROM build as prod
ENV NODE_ENV=production
WORKDIR /prod
COPY package.json ./
RUN yarn install --production
COPY --from=buil /build/dist ./dist
COPY --from=buil /build/build ./build
EXPOSE 3000
CMD ["node", "dist/server.js"]

View File

@ -1,4 +1,4 @@
{
"ext": "ts",
"exec": "ts-node src/server.ts"
"exec": "yarn generate:types && ts-node src/server.ts"
}

View File

@ -1,62 +1,62 @@
import { CollectionConfig } from 'payload/types';
import { CollectionConfig } from "payload/types";
const Posts: CollectionConfig = {
slug: 'posts',
slug: "posts",
admin: {
defaultColumns: ['title', 'author', 'category', 'tags', 'status'],
useAsTitle: 'title',
defaultColumns: ["title", "author", "category", "tags", "status"],
useAsTitle: "title",
},
access: {
read: () => true,
},
fields: [
{
name: 'title',
type: 'text',
name: "title",
type: "text",
},
{
name: 'author',
type: 'relationship',
relationTo: 'users',
name: "author",
type: "relationship",
relationTo: "users",
},
{
name: 'publishedDate',
type: 'date',
name: "publishedDate",
type: "date",
},
{
name: 'category',
type: 'relationship',
relationTo: 'categories'
name: "category",
type: "relationship",
relationTo: "categories",
},
{
name: 'tags',
type: 'relationship',
relationTo: 'tags',
name: "tags",
type: "relationship",
relationTo: "tags",
hasMany: true,
},
{
name: 'content',
type: 'richText'
name: "content",
type: "richText",
},
{
name: 'status',
type: 'select',
name: "status",
type: "select",
options: [
{
value: 'draft',
label: 'Draft',
value: "draft",
label: "Draft",
},
{
value: 'published',
label: 'Published',
value: "published",
label: "Published",
},
],
defaultValue: 'draft',
defaultValue: "draft",
admin: {
position: 'sidebar',
}
}
position: "sidebar",
},
},
],
}
};
export default Posts;
export default Posts;

View File

@ -12,6 +12,6 @@ export default buildConfig({
},
collections: [Categories, Posts, Tags, Users],
typescript: {
outputFile: path.resolve("../", "types.ts"),
outputFile: path.resolve("/", "types.ts"),
},
});