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

View File

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

View File

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

View File

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

View File

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