Updated everything

This commit is contained in:
DrMint 2024-02-02 12:57:57 +01:00
parent e8d8c8e6a8
commit a0728eac51
9 changed files with 1280 additions and 888 deletions

BIN
bun.lockb

Binary file not shown.

1690
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,35 +19,34 @@
"precommit": "npm run generate:types && npm run prettier && npm run unused-exports && npm run tsc", "precommit": "npm run generate:types && npm run prettier && npm run unused-exports && npm run tsc",
"upgrade": "ncu", "upgrade": "ncu",
"clean": "sudo rm -r uploads mongo", "clean": "sudo rm -r uploads mongo",
"start": "sudo docker compose up", "start": "npm install && npm run generate:types && npm run dev"
"stop": "sudo docker compose down"
}, },
"dependencies": { "dependencies": {
"@fontsource/vollkorn": "^5.0.17", "@fontsource/vollkorn": "5.0.18",
"@payloadcms/bundler-webpack": "^1.0.5", "@payloadcms/bundler-webpack": "1.0.6",
"@payloadcms/db-mongodb": "^1.0.8", "@payloadcms/db-mongodb": "1.3.2",
"@payloadcms/richtext-lexical": "^0.1.17", "@payloadcms/richtext-lexical": "0.5.2",
"cross-env": "^7.0.3", "cross-env": "7.0.3",
"language-tags": "^1.0.9", "language-tags": "1.0.9",
"luxon": "^3.4.3", "luxon": "3.4.4",
"payload": "^2.1.1", "payload": "2.8.2",
"sharp": "^0.33.2", "sharp": "0.33.2",
"styled-components": "^6.1.1" "styled-components": "6.1.8"
}, },
"devDependencies": { "devDependencies": {
"@types/dotenv": "^8.2.0", "@types/dotenv": "8.2.0",
"@types/express": "^4.17.21", "@types/express": "4.17.21",
"@types/language-tags": "^1.0.4", "@types/language-tags": "1.0.4",
"@types/luxon": "^3.3.4", "@types/luxon": "3.4.2",
"@types/qs": "^6.9.10", "@types/qs": "6.9.11",
"@types/react-router-dom": "^5.3.3", "@types/react-router-dom": "5.3.3",
"@types/styled-components": "^5.1.30", "@types/styled-components": "5.1.34",
"copyfiles": "^2.4.1", "copyfiles": "2.4.1",
"nodemon": "^3.0.1", "nodemon": "3.0.3",
"npm-check-updates": "^16.14.6", "npm-check-updates": "16.14.12",
"prettier": "^3.0.3", "prettier": "3.2.4",
"ts-node": "^10.9.1", "ts-node": "10.9.1",
"ts-unused-exports": "^10.0.1", "ts-unused-exports": "10.0.1",
"typescript": "^5.2.2" "typescript": "5.3.3"
} }
} }

46
podman.yml Normal file
View File

@ -0,0 +1,46 @@
apiVersion: v1
kind: Pod
metadata:
labels:
app: payload-pod
name: payload-pod
spec:
containers:
- args:
- --storageEngine=wiredTiger
image: docker.io/library/mongo:latest
name: payload-mongo
ports:
- containerPort: 27017
hostPort: 27017
volumeMounts:
- mountPath: /data/db
name: payload-mongo-volume
- args:
env:
- name: PORT
value: 40062
- name: MONGODB_URI
value: mongodb://localhost:27017/payload
- name: PAYLOAD_SECRET
value: 02e32724b99b5823519837a6
- name: NODE_ENV
value: development
image: docker.io/library/node:18-alpine
name: payload-node
ports:
- containerPort: 40062
hostPort: 40062
volumeMounts:
- mountPath: /home/node/app
name: payload-node-volume
workingDir: /home/node/app/
volumes:
- hostPath:
path: /home/deck/Repos/payload
type: Directory
name: payload-node-volume
- hostPath:
path: /home/deck/Repos/payload/mongo
type: Directory
name: payload-mongo-volume

View File

@ -35,7 +35,7 @@ const fields = {
video: "video", video: "video",
videoNotes: "videoNotes", videoNotes: "videoNotes",
audio: "audio", audio: "audio",
audioNotes: "videoNotes", audioNotes: "audioNotes",
status: "status", status: "status",
updatedBy: "updatedBy", updatedBy: "updatedBy",
previousContents: "previousContents", previousContents: "previousContents",

View File

@ -288,7 +288,7 @@ export const LibraryItems = buildVersionedCollectionConfig({
relationTo: Collections.LibraryItemsScans, relationTo: Collections.LibraryItemsScans,
}), }),
imageField({ imageField({
name: fields.scansCoverBack, name: fields.scansCoverInsideBack,
relationTo: Collections.LibraryItemsScans, relationTo: Collections.LibraryItemsScans,
}), }),
]), ]),

View File

@ -10,8 +10,20 @@ export type RecorderBiographies =
| { | {
language: string | Language; language: string | Language;
biography: { biography: {
root: {
children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[]; }[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
};
id?: string | null; id?: string | null;
}[] }[]
| null; | null;
@ -26,7 +38,7 @@ export type CategoryTranslations =
export interface Config { export interface Config {
collections: { collections: {
'library-folders': LibraryFolder; folders: Folder;
'library-items': LibraryItem; 'library-items': LibraryItem;
contents: Content; contents: Content;
'contents-folders': ContentsFolder; 'contents-folders': ContentsFolder;
@ -55,24 +67,37 @@ export interface Config {
}; };
globals: {}; globals: {};
} }
export interface LibraryFolder { export interface Folder {
id: string; id: string;
slug: string; slug: string;
translations?: translations?:
| { | {
language: string | Language; language: string | Language;
name: string; name: string;
description?:
| {
[k: string]: unknown;
}[]
| null;
id?: string | null; id?: string | null;
}[] }[]
| null; | null;
parentFolders?: (string | LibraryFolder)[] | null; sections?:
subfolders?: (string | LibraryFolder)[] | null; | {
items?: (string | LibraryItem)[] | null; name?: string | null;
subfolders?: (string | Folder)[] | null;
id?: string | null;
}[]
| null;
files?:
| (
| {
relationTo: 'library-items';
value: string | LibraryItem;
}
| {
relationTo: 'contents';
value: string | Content;
}
)[]
| null;
updatedAt: string;
createdAt: string;
} }
export interface Language { export interface Language {
id: string; id: string;
@ -105,6 +130,7 @@ export interface LibraryItem {
spine?: string | LibraryItemScans | null; spine?: string | LibraryItemScans | null;
back?: string | LibraryItemScans | null; back?: string | LibraryItemScans | null;
insideFront?: string | LibraryItemScans | null; insideFront?: string | LibraryItemScans | null;
insideBack?: string | LibraryItemScans | null;
flapFront?: string | LibraryItemScans | null; flapFront?: string | LibraryItemScans | null;
flapBack?: string | LibraryItemScans | null; flapBack?: string | LibraryItemScans | null;
insideFlapFront?: string | LibraryItemScans | null; insideFlapFront?: string | LibraryItemScans | null;
@ -188,8 +214,20 @@ export interface LibraryItem {
| { | {
language: string | Language; language: string | Language;
description: { description: {
root: {
children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[]; }[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
};
id?: string | null; id?: string | null;
}[] }[]
| null; | null;
@ -199,7 +237,6 @@ export interface LibraryItem {
id?: string | null; id?: string | null;
}[] }[]
| null; | null;
parentFolders?: (string | LibraryFolder)[] | null;
parentItems?: (string | LibraryItem)[] | null; parentItems?: (string | LibraryItem)[] | null;
subitems?: (string | LibraryItem)[] | null; subitems?: (string | LibraryItem)[] | null;
contents?: contents?:
@ -209,11 +246,21 @@ export interface LibraryItem {
pageEnd?: number | null; pageEnd?: number | null;
timeStart?: number | null; timeStart?: number | null;
timeEnd?: number | null; timeEnd?: number | null;
note?: note?: {
| { root: {
children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[] }[];
| null; direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
} | null;
id?: string | null; id?: string | null;
}[] }[]
| null; | null;
@ -420,31 +467,86 @@ export interface Content {
pretitle?: string | null; pretitle?: string | null;
title: string; title: string;
subtitle?: string | null; subtitle?: string | null;
summary?: summary?: {
| { root: {
children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[] }[];
| null; direction: ('ltr' | 'rtl') | null;
textContent?: format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
| { indent: number;
type: string;
version: number;
};
[k: string]: unknown; [k: string]: unknown;
}[] } | null;
| null; textContent?: {
root: {
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
} | null;
textTranscribers?: (string | Recorder)[] | null; textTranscribers?: (string | Recorder)[] | null;
textTranslators?: (string | Recorder)[] | null; textTranslators?: (string | Recorder)[] | null;
textProofreaders?: (string | Recorder)[] | null; textProofreaders?: (string | Recorder)[] | null;
textNotes?: textNotes?: {
| { root: {
children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[] }[];
| null; direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
} | null;
video?: (string | null) | File; video?: (string | null) | File;
videoNotes?: videoNotes?: {
| { root: {
children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[] }[];
| null; direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
} | null;
audio?: (string | null) | File; audio?: (string | null) | File;
audioNotes?: {
root: {
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
} | null;
id?: string | null; id?: string | null;
}[]; }[];
folders?: (string | ContentsFolder)[] | null; folders?: (string | ContentsFolder)[] | null;
@ -516,16 +618,36 @@ export interface Post {
language: string | Language; language: string | Language;
sourceLanguage: string | Language; sourceLanguage: string | Language;
title: string; title: string;
summary?: summary?: {
| { root: {
children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[] }[];
| null; direction: ('ltr' | 'rtl') | null;
content?: format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
| { indent: number;
type: string;
version: number;
};
[k: string]: unknown; [k: string]: unknown;
}[] } | null;
| null; content?: {
root: {
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
} | null;
translators?: (string | Recorder)[] | null; translators?: (string | Recorder)[] | null;
proofreaders?: (string | Recorder)[] | null; proofreaders?: (string | Recorder)[] | null;
id?: string | null; id?: string | null;
@ -588,16 +710,36 @@ export interface ChronologyItem {
language: string | Language; language: string | Language;
sourceLanguage: string | Language; sourceLanguage: string | Language;
title?: string | null; title?: string | null;
description?: description?: {
| { root: {
children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[] }[];
| null; direction: ('ltr' | 'rtl') | null;
notes?: format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
| { indent: number;
type: string;
version: number;
};
[k: string]: unknown; [k: string]: unknown;
}[] } | null;
| null; notes?: {
root: {
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
} | null;
transcribers?: (string | Recorder)[] | null; transcribers?: (string | Recorder)[] | null;
translators?: (string | Recorder)[] | null; translators?: (string | Recorder)[] | null;
proofreaders?: (string | Recorder)[] | null; proofreaders?: (string | Recorder)[] | null;
@ -619,11 +761,21 @@ export interface ChronologyEra {
| { | {
language: string | Language; language: string | Language;
title: string; title: string;
description?: description?: {
| { root: {
children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[] }[];
| null; direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
} | null;
id?: string | null; id?: string | null;
}[] }[]
| null; | null;
@ -643,31 +795,81 @@ export interface Weapon {
language: string | Language; language: string | Language;
sourceLanguage: string | Language; sourceLanguage: string | Language;
name: string; name: string;
description?: description?: {
| { root: {
children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[] }[];
| null; direction: ('ltr' | 'rtl') | null;
level1?: format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
| { indent: number;
type: string;
version: number;
};
[k: string]: unknown; [k: string]: unknown;
}[] } | null;
| null; level1?: {
level2?: root: {
| { children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[] }[];
| null; direction: ('ltr' | 'rtl') | null;
level3?: format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
| { indent: number;
type: string;
version: number;
};
[k: string]: unknown; [k: string]: unknown;
}[] } | null;
| null; level2?: {
level4?: root: {
| { children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[] }[];
| null; direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
} | null;
level3?: {
root: {
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
} | null;
level4?: {
root: {
children: {
type: string;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
} | null;
transcribers?: (string | Recorder)[] | null; transcribers?: (string | Recorder)[] | null;
translators?: (string | Recorder)[] | null; translators?: (string | Recorder)[] | null;
proofreaders?: (string | Recorder)[] | null; proofreaders?: (string | Recorder)[] | null;
@ -741,8 +943,20 @@ export interface WeaponsGroup {
export interface Note { export interface Note {
id: string; id: string;
note: { note: {
root: {
children: {
type: string;
version: number;
[k: string]: unknown; [k: string]: unknown;
}[]; }[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
type: string;
version: number;
};
[k: string]: unknown;
};
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
} }

View File

@ -1,5 +1,4 @@
import { import {
AdapterProps,
AlignFeature, AlignFeature,
BlocksFeature, BlocksFeature,
BoldTextFeature, BoldTextFeature,
@ -17,11 +16,11 @@ import {
StrikethroughTextFeature, StrikethroughTextFeature,
SubscriptTextFeature, SubscriptTextFeature,
SuperscriptTextFeature, SuperscriptTextFeature,
TreeviewFeature, TreeViewFeature,
UnderlineTextFeature, UnderlineTextFeature,
UnoderedListFeature, UnorderedListFeature,
UploadFeature, UploadFeature,
lexicalEditor, lexicalEditor
} from "@payloadcms/richtext-lexical"; } from "@payloadcms/richtext-lexical";
import { Block, RichTextAdapter } from "payload/types"; import { Block, RichTextAdapter } from "payload/types";
@ -47,13 +46,13 @@ export const createEditor = ({
links = false, links = false,
relations = false, relations = false,
alignment = false, alignment = false,
}: Partial<EditorOptions>): RichTextAdapter<any, AdapterProps> => { }: Partial<EditorOptions>): RichTextAdapter<any, any, any> => {
const enabledFeatures: FeatureProvider[] = []; const enabledFeatures: FeatureProvider[] = [];
if (lists) enabledFeatures.push(OrderedListFeature(), UnoderedListFeature(), CheckListFeature()); if (lists) enabledFeatures.push(OrderedListFeature(), UnorderedListFeature(), CheckListFeature());
if (blocks.length > 0) enabledFeatures.push(BlocksFeature({ blocks })); if (blocks.length > 0) enabledFeatures.push(BlocksFeature({ blocks }));
if (headings) enabledFeatures.push(ParagraphFeature(), HeadingFeature({})); if (headings) enabledFeatures.push(ParagraphFeature(), HeadingFeature({}));
if (debugs) enabledFeatures.push(TreeviewFeature()); if (debugs) enabledFeatures.push(TreeViewFeature());
if (images) enabledFeatures.push(UploadFeature({ collections: [] })); if (images) enabledFeatures.push(UploadFeature({ collections: [] }));
if (links) enabledFeatures.push(LinkFeature({})); if (links) enabledFeatures.push(LinkFeature({}));
if (relations) enabledFeatures.push(RelationshipFeature()); if (relations) enabledFeatures.push(RelationshipFeature());

View File

@ -26,7 +26,7 @@ export const buildVersionedCollectionConfig = ({
}: BuildVersionedCollectionConfig): CollectionConfig => ({ }: BuildVersionedCollectionConfig): CollectionConfig => ({
...otherParams, ...otherParams,
timestamps: true, timestamps: true,
versions: { drafts: { autosave: false } }, versions: { drafts: { autosave: true } },
hooks: { hooks: {
...otherHooks, ...otherHooks,
beforeChange: [...(beforeChange ?? []), beforeChangeUpdatedBy], beforeChange: [...(beforeChange ?? []), beforeChangeUpdatedBy],