This commit is contained in:
龟男日记\www 2026-02-08 23:40:05 +08:00
parent 1692cee9aa
commit a7da4da87c
6 changed files with 1828 additions and 35 deletions

View File

@ -10,23 +10,23 @@ services:
- node_modules:/home/node/app/node_modules
working_dir: /home/node/app/
command: sh -c "corepack enable && corepack prepare pnpm@latest --activate && pnpm install && pnpm dev"
depends_on:
- mongo
# depends_on:
# - mongo
# - postgres
env_file:
- .env
# Ensure your DATABASE_URL uses 'mongo' as the hostname ie. mongodb://mongo/my-db-name
mongo:
image: mongo:latest
ports:
- '27017:27017'
command:
- --storageEngine=wiredTiger
volumes:
- data:/data/db
logging:
driver: none
# mongo:
# image: mongo:latest
# ports:
# - '27017:27017'
# command:
# - --storageEngine=wiredTiger
# volumes:
# - data:/data/db
# logging:
# driver: none
# Uncomment the following to use postgres
# postgres:

View File

@ -18,8 +18,12 @@
"test:int": "cross-env NODE_OPTIONS=--no-deprecation vitest run --config ./vitest.config.mts"
},
"dependencies": {
"@payloadcms/db-postgres": "3.75.0",
"@payloadcms/next": "3.75.0",
"@payloadcms/plugin-cloud": "^3.0.2",
"@payloadcms/plugin-cloud-storage": "^3.75.0",
"@payloadcms/richtext-lexical": "3.75.0",
"@payloadcms/storage-s3": "^3.75.0",
"@payloadcms/ui": "3.75.0",
"cross-env": "^7.0.3",
"dotenv": "16.4.7",
@ -28,8 +32,7 @@
"payload": "3.75.0",
"react": "19.2.1",
"react-dom": "19.2.1",
"sharp": "0.34.2",
"@payloadcms/db-postgres": "3.75.0"
"sharp": "0.34.2"
},
"devDependencies": {
"@playwright/test": "1.56.1",

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,7 @@
import { S3ClientUploadHandler as S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24 } from '@payloadcms/storage-s3/client'
import { CollectionCards as CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 } from '@payloadcms/next/rsc'
export const importMap = {
'@payloadcms/next/rsc#CollectionCards': CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1,
"@payloadcms/storage-s3/client#S3ClientUploadHandler": S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24,
"@payloadcms/next/rsc#CollectionCards": CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1
}

View File

@ -84,7 +84,7 @@ export interface Config {
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
};
db: {
defaultIDType: string;
defaultIDType: number;
};
fallbackLocale: null;
globals: {};
@ -119,7 +119,7 @@ export interface UserAuthOperations {
* via the `definition` "users".
*/
export interface User {
id: string;
id: number;
updatedAt: string;
createdAt: string;
email: string;
@ -144,7 +144,7 @@ export interface User {
* via the `definition` "media".
*/
export interface Media {
id: string;
id: number;
alt: string;
updatedAt: string;
createdAt: string;
@ -163,7 +163,7 @@ export interface Media {
* via the `definition` "payload-kv".
*/
export interface PayloadKv {
id: string;
id: number;
key: string;
data:
| {
@ -180,20 +180,20 @@ export interface PayloadKv {
* via the `definition` "payload-locked-documents".
*/
export interface PayloadLockedDocument {
id: string;
id: number;
document?:
| ({
relationTo: 'users';
value: string | User;
value: number | User;
} | null)
| ({
relationTo: 'media';
value: string | Media;
value: number | Media;
} | null);
globalSlug?: string | null;
user: {
relationTo: 'users';
value: string | User;
value: number | User;
};
updatedAt: string;
createdAt: string;
@ -203,10 +203,10 @@ export interface PayloadLockedDocument {
* via the `definition` "payload-preferences".
*/
export interface PayloadPreference {
id: string;
id: number;
user: {
relationTo: 'users';
value: string | User;
value: number | User;
};
key?: string | null;
value?:
@ -226,7 +226,7 @@ export interface PayloadPreference {
* via the `definition` "payload-migrations".
*/
export interface PayloadMigration {
id: string;
id: number;
name?: string | null;
batch?: number | null;
updatedAt: string;

View File

@ -7,6 +7,7 @@ import sharp from 'sharp'
import { Users } from './collections/Users'
import { Media } from './collections/Media'
import { s3Storage } from '@payloadcms/storage-s3'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
@ -30,5 +31,26 @@ export default buildConfig({
},
}),
sharp,
plugins: [],
plugins: [
// Cloudflare R2 Storage via S3 API
s3Storage({
collections: {
media: {
disableLocalStorage: true,
generateFileURL: ({ filename }) => {
return `${process.env.CLOUDFLARE_R2_PUBLIC_URL}/${filename}`
},
},
},
bucket: process.env.CLOUDFLARE_R2_BUCKET || '',
config: {
credentials: {
accessKeyId: process.env.CLOUDFLARE_R2_ACCESS_KEY_ID || '',
secretAccessKey: process.env.CLOUDFLARE_R2_SECRET_ACCESS_KEY || '',
},
region: process.env.CLOUDFLARE_R2_REGION || 'auto',
endpoint: process.env.CLOUDFLARE_R2_ENDPOINT || '',
},
}),
],
})