🗑️ Remove keystone stuff
This commit is contained in:
parent
afaf9fdea4
commit
f81cf2ff9b
@ -1 +0,0 @@
|
||||
PUBLIC_CMS="http://localhost:3000"
|
4
content/.gitignore
vendored
4
content/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
.keystone/admin
|
||||
keystone.db
|
||||
*.log
|
@ -1,488 +0,0 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// keystone.ts
|
||||
var keystone_exports = {};
|
||||
__export(keystone_exports, {
|
||||
default: () => keystone_default
|
||||
});
|
||||
module.exports = __toCommonJS(keystone_exports);
|
||||
var import_core8 = require("@keystone-6/core");
|
||||
|
||||
// schema/index.ts
|
||||
var import_core7 = require("@keystone-6/core");
|
||||
var import_fields7 = require("@keystone-6/core/fields");
|
||||
|
||||
// limit.ts
|
||||
var isUser = ({ session: session2 }) => session2?.data.id != null;
|
||||
var allowUser = {
|
||||
operation: {
|
||||
create: isUser,
|
||||
update: isUser,
|
||||
delete: isUser
|
||||
}
|
||||
};
|
||||
var isEditor = ({ session: session2 }) => session2?.data.isEditor || session2?.data.isAdmin;
|
||||
var allowEditor = {
|
||||
operation: {
|
||||
create: isEditor,
|
||||
update: isEditor,
|
||||
delete: isEditor
|
||||
}
|
||||
};
|
||||
var isAdmin = ({ session: session2 }) => session2?.data.isAdmin;
|
||||
var allowAdmin = {
|
||||
operation: {
|
||||
create: isAdmin,
|
||||
update: isAdmin,
|
||||
delete: isAdmin
|
||||
}
|
||||
};
|
||||
|
||||
// schema/assets.ts
|
||||
var import_fields = require("@keystone-6/core/fields");
|
||||
var import_core = require("@keystone-6/core");
|
||||
var Image = (0, import_core.list)({
|
||||
access: allowEditor,
|
||||
fields: {
|
||||
caption: (0, import_fields.text)(),
|
||||
image: (0, import_fields.image)({ storage: "localImages" }),
|
||||
createdAt: (0, import_fields.timestamp)({
|
||||
defaultValue: { kind: "now" }
|
||||
})
|
||||
}
|
||||
});
|
||||
var Asset = (0, import_core.list)({
|
||||
access: allowEditor,
|
||||
fields: {
|
||||
caption: (0, import_fields.text)(),
|
||||
url: (0, import_fields.text)({ validation: { isRequired: true } }),
|
||||
type: (0, import_fields.select)({
|
||||
type: "enum",
|
||||
options: [
|
||||
{ label: "Video", value: "video" },
|
||||
{ label: "Audio", value: "audio" }
|
||||
],
|
||||
defaultValue: "video",
|
||||
db: { map: "media_type" },
|
||||
validation: { isRequired: true },
|
||||
ui: { displayMode: "select" }
|
||||
}),
|
||||
createdAt: (0, import_fields.timestamp)({
|
||||
defaultValue: { kind: "now" }
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
// schema/moments.ts
|
||||
var import_core2 = require("@keystone-6/core");
|
||||
var import_fields_document = require("@keystone-6/fields-document");
|
||||
var import_fields2 = require("@keystone-6/core/fields");
|
||||
var Moment = (0, import_core2.list)({
|
||||
access: allowUser,
|
||||
fields: {
|
||||
title: (0, import_fields2.text)({ validation: { isRequired: true } }),
|
||||
images: (0, import_fields2.relationship)({ ref: "Image", many: true }),
|
||||
content: (0, import_fields_document.document)({
|
||||
formatting: true,
|
||||
layouts: [
|
||||
[1, 1],
|
||||
[1, 1, 1],
|
||||
[2, 1],
|
||||
[1, 2],
|
||||
[1, 2, 1]
|
||||
],
|
||||
links: true,
|
||||
dividers: true
|
||||
}),
|
||||
author: (0, import_fields2.relationship)({
|
||||
ref: "User.moments",
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name", "email"],
|
||||
inlineEdit: { fields: ["name", "email"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true
|
||||
},
|
||||
many: false
|
||||
}),
|
||||
categories: (0, import_fields2.relationship)({
|
||||
ref: "Category.moments",
|
||||
many: true,
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name"],
|
||||
inlineEdit: { fields: ["name"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
inlineCreate: { fields: ["name"] }
|
||||
}
|
||||
}),
|
||||
tags: (0, import_fields2.relationship)({
|
||||
ref: "Tag.moments",
|
||||
many: true,
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name"],
|
||||
inlineEdit: { fields: ["name"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
inlineCreate: { fields: ["name"] }
|
||||
}
|
||||
}),
|
||||
createdAt: (0, import_fields2.timestamp)({
|
||||
defaultValue: { kind: "now" }
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
// schema/categories.ts
|
||||
var import_core3 = require("@keystone-6/core");
|
||||
var import_fields3 = require("@keystone-6/core/fields");
|
||||
var Category = (0, import_core3.list)({
|
||||
access: allowEditor,
|
||||
fields: {
|
||||
slug: (0, import_fields3.text)({
|
||||
validation: {
|
||||
isRequired: true
|
||||
},
|
||||
isIndexed: "unique"
|
||||
}),
|
||||
name: (0, import_fields3.text)(),
|
||||
posts: (0, import_fields3.relationship)({ ref: "Post.categories", many: true }),
|
||||
moments: (0, import_fields3.relationship)({ ref: "Moment.categories", many: true }),
|
||||
events: (0, import_fields3.relationship)({ ref: "Event.categories", many: true })
|
||||
}
|
||||
});
|
||||
var Tag = (0, import_core3.list)({
|
||||
access: allowEditor,
|
||||
fields: {
|
||||
slug: (0, import_fields3.text)({
|
||||
validation: {
|
||||
isRequired: true
|
||||
},
|
||||
isIndexed: "unique"
|
||||
}),
|
||||
name: (0, import_fields3.text)(),
|
||||
posts: (0, import_fields3.relationship)({ ref: "Post.tags", many: true }),
|
||||
moments: (0, import_fields3.relationship)({ ref: "Moment.tags", many: true }),
|
||||
events: (0, import_fields3.relationship)({ ref: "Event.tags", many: true })
|
||||
}
|
||||
});
|
||||
|
||||
// schema/projects.ts
|
||||
var import_fields4 = require("@keystone-6/core/fields");
|
||||
var import_core4 = require("@keystone-6/core");
|
||||
var Project = (0, import_core4.list)({
|
||||
access: {
|
||||
...allowAdmin,
|
||||
filter: {
|
||||
query: ({ session: session2 }) => {
|
||||
if (session2?.data.isEditor || session2?.data.isAdmin)
|
||||
return true;
|
||||
return { isPublished: { equals: true } };
|
||||
}
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
icon: (0, import_fields4.relationship)({ ref: "Image" }),
|
||||
name: (0, import_fields4.text)({ validation: { isRequired: true } }),
|
||||
description: (0, import_fields4.text)(),
|
||||
link: (0, import_fields4.text)(),
|
||||
isPublished: (0, import_fields4.checkbox)(),
|
||||
status: (0, import_fields4.select)({
|
||||
type: "enum",
|
||||
options: [
|
||||
{ label: "Pending", value: "pending" },
|
||||
{ label: "Constructing", value: "constructing" },
|
||||
{ label: "Published", value: "published" },
|
||||
{ label: "Abandoned", value: "abandoned" }
|
||||
],
|
||||
defaultValue: "pending",
|
||||
db: { map: "project_status" },
|
||||
validation: { isRequired: true },
|
||||
ui: { displayMode: "select" }
|
||||
}),
|
||||
post: (0, import_fields4.relationship)({ ref: "Post" }),
|
||||
createdAt: (0, import_fields4.timestamp)({
|
||||
defaultValue: { kind: "now" }
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
// schema/posts.ts
|
||||
var import_fields5 = require("@keystone-6/core/fields");
|
||||
var import_fields_document2 = require("@keystone-6/fields-document");
|
||||
var import_core5 = require("@keystone-6/core");
|
||||
var Post = (0, import_core5.list)({
|
||||
access: {
|
||||
...allowEditor,
|
||||
filter: {
|
||||
query: ({ session: session2 }) => {
|
||||
if (session2?.data.isEditor || session2?.data.isAdmin)
|
||||
return true;
|
||||
return { isPublished: { equals: true } };
|
||||
}
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
slug: (0, import_fields5.text)({
|
||||
validation: {
|
||||
isRequired: true
|
||||
},
|
||||
isIndexed: "unique"
|
||||
}),
|
||||
title: (0, import_fields5.text)({ validation: { isRequired: true } }),
|
||||
cover: (0, import_fields5.relationship)({ ref: "Image" }),
|
||||
description: (0, import_fields5.text)(),
|
||||
assets: (0, import_fields5.relationship)({ ref: "Asset", many: true }),
|
||||
images: (0, import_fields5.relationship)({ ref: "Image", many: true }),
|
||||
content: (0, import_fields_document2.document)({
|
||||
formatting: true,
|
||||
layouts: [
|
||||
[1, 1],
|
||||
[1, 1, 1],
|
||||
[2, 1],
|
||||
[1, 2],
|
||||
[1, 2, 1]
|
||||
],
|
||||
links: true,
|
||||
dividers: true
|
||||
}),
|
||||
type: (0, import_fields5.select)({
|
||||
type: "enum",
|
||||
options: [
|
||||
{ label: "Article", value: "article" },
|
||||
{ label: "Podcast", value: "podcast" }
|
||||
],
|
||||
defaultValue: "article",
|
||||
db: { map: "post_type" },
|
||||
validation: { isRequired: true },
|
||||
ui: { displayMode: "select" }
|
||||
}),
|
||||
isPublished: (0, import_fields5.checkbox)(),
|
||||
author: (0, import_fields5.relationship)({
|
||||
ref: "User.posts",
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name", "email"],
|
||||
inlineEdit: { fields: ["name", "email"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true
|
||||
},
|
||||
many: false
|
||||
}),
|
||||
categories: (0, import_fields5.relationship)({
|
||||
ref: "Category.posts",
|
||||
many: true,
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name"],
|
||||
inlineEdit: { fields: ["name"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
inlineCreate: { fields: ["name"] }
|
||||
}
|
||||
}),
|
||||
tags: (0, import_fields5.relationship)({
|
||||
ref: "Tag.posts",
|
||||
many: true,
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name"],
|
||||
inlineEdit: { fields: ["name"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
inlineCreate: { fields: ["name"] }
|
||||
}
|
||||
}),
|
||||
createdAt: (0, import_fields5.timestamp)({
|
||||
defaultValue: { kind: "now" }
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
// schema/events.ts
|
||||
var import_fields6 = require("@keystone-6/core/fields");
|
||||
var import_fields_document3 = require("@keystone-6/fields-document");
|
||||
var import_core6 = require("@keystone-6/core");
|
||||
var Event = (0, import_core6.list)({
|
||||
access: {
|
||||
...allowEditor,
|
||||
filter: {
|
||||
query: ({ session: session2 }) => {
|
||||
if (session2?.data.isEditor || session2?.data.isAdmin)
|
||||
return true;
|
||||
return { isPublished: { equals: true } };
|
||||
}
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
slug: (0, import_fields6.text)({
|
||||
validation: {
|
||||
isRequired: true
|
||||
},
|
||||
isIndexed: "unique"
|
||||
}),
|
||||
title: (0, import_fields6.text)({ validation: { isRequired: true } }),
|
||||
description: (0, import_fields6.text)(),
|
||||
content: (0, import_fields_document3.document)({
|
||||
formatting: true,
|
||||
layouts: [
|
||||
[1, 1],
|
||||
[1, 1, 1],
|
||||
[2, 1],
|
||||
[1, 2],
|
||||
[1, 2, 1]
|
||||
],
|
||||
links: true,
|
||||
dividers: true
|
||||
}),
|
||||
isPublished: (0, import_fields6.checkbox)(),
|
||||
isHistory: (0, import_fields6.checkbox)(),
|
||||
author: (0, import_fields6.relationship)({
|
||||
ref: "User.events",
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name", "email"],
|
||||
inlineEdit: { fields: ["name", "email"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true
|
||||
},
|
||||
many: false
|
||||
}),
|
||||
categories: (0, import_fields6.relationship)({
|
||||
ref: "Category.events",
|
||||
many: true,
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name"],
|
||||
inlineEdit: { fields: ["name"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
inlineCreate: { fields: ["name"] }
|
||||
}
|
||||
}),
|
||||
tags: (0, import_fields6.relationship)({
|
||||
ref: "Tag.events",
|
||||
many: true,
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name"],
|
||||
inlineEdit: { fields: ["name"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
inlineCreate: { fields: ["name"] }
|
||||
}
|
||||
}),
|
||||
createdAt: (0, import_fields6.timestamp)({
|
||||
defaultValue: { kind: "now" }
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
// schema/index.ts
|
||||
var lists = {
|
||||
User: (0, import_core7.list)({
|
||||
access: allowAdmin,
|
||||
fields: {
|
||||
name: (0, import_fields7.text)({ validation: { isRequired: true } }),
|
||||
email: (0, import_fields7.text)({
|
||||
validation: { isRequired: true },
|
||||
isIndexed: "unique"
|
||||
}),
|
||||
password: (0, import_fields7.password)({ validation: { isRequired: true } }),
|
||||
posts: (0, import_fields7.relationship)({ ref: "Post.author", many: true }),
|
||||
moments: (0, import_fields7.relationship)({ ref: "Moment.author", many: true }),
|
||||
events: (0, import_fields7.relationship)({ ref: "Event.author", many: true }),
|
||||
isAdmin: (0, import_fields7.checkbox)(),
|
||||
isEditor: (0, import_fields7.checkbox)(),
|
||||
createdAt: (0, import_fields7.timestamp)({
|
||||
defaultValue: { kind: "now" }
|
||||
})
|
||||
}
|
||||
}),
|
||||
Image,
|
||||
Asset,
|
||||
Post,
|
||||
Moment,
|
||||
Project,
|
||||
Event,
|
||||
Category,
|
||||
Tag
|
||||
};
|
||||
|
||||
// auth.ts
|
||||
var import_crypto = require("crypto");
|
||||
var import_auth = require("@keystone-6/auth");
|
||||
var import_session = require("@keystone-6/core/session");
|
||||
var sessionSecret = process.env.SESSION_SECRET;
|
||||
if (!sessionSecret && process.env.NODE_ENV !== "production") {
|
||||
sessionSecret = (0, import_crypto.randomBytes)(32).toString("hex");
|
||||
}
|
||||
var { withAuth } = (0, import_auth.createAuth)({
|
||||
listKey: "User",
|
||||
identityField: "email",
|
||||
sessionData: "id name createdAt isAdmin isEditor",
|
||||
secretField: "password",
|
||||
initFirstItem: {
|
||||
fields: ["name", "email", "password", "isAdmin"]
|
||||
}
|
||||
});
|
||||
var sessionMaxAge = 60 * 60 * 24 * 30;
|
||||
var session = (0, import_session.statelessSessions)({
|
||||
maxAge: sessionMaxAge,
|
||||
secret: sessionSecret
|
||||
});
|
||||
|
||||
// keystone.ts
|
||||
var baseUrl = process.env.BASE_URL ?? "http://localhost:3000";
|
||||
var databaseUrl = process.env.DATABASE_URL ?? "postgresql://postgres:password@127.0.0.1:5432/capital";
|
||||
var databaseProvider = process.env.DATABASE_PROVIDER ?? "postgresql";
|
||||
var keystone_default = withAuth(
|
||||
(0, import_core8.config)({
|
||||
ui: {
|
||||
basePath: "/cms"
|
||||
},
|
||||
db: {
|
||||
provider: databaseProvider,
|
||||
url: databaseUrl
|
||||
},
|
||||
server: {
|
||||
cors: {
|
||||
origin: "*",
|
||||
methods: "GET,HEAD,PUT,PATCH,POST,DELETE"
|
||||
}
|
||||
},
|
||||
storage: {
|
||||
localImages: {
|
||||
kind: "local",
|
||||
type: "image",
|
||||
generateUrl: (path) => `${baseUrl}/images${path}`,
|
||||
serverRoute: {
|
||||
path: "/images"
|
||||
},
|
||||
storagePath: "public/images"
|
||||
}
|
||||
},
|
||||
lists,
|
||||
session
|
||||
})
|
||||
);
|
||||
//# sourceMappingURL=config.js.map
|
File diff suppressed because one or more lines are too long
@ -1,40 +0,0 @@
|
||||
import { randomBytes } from "crypto";
|
||||
import { createAuth } from "@keystone-6/auth";
|
||||
|
||||
import { statelessSessions } from "@keystone-6/core/session";
|
||||
|
||||
let sessionSecret = process.env.SESSION_SECRET;
|
||||
if (!sessionSecret && process.env.NODE_ENV !== "production") {
|
||||
sessionSecret = randomBytes(32).toString("hex");
|
||||
}
|
||||
|
||||
export type Session = {
|
||||
data: {
|
||||
id: string;
|
||||
name: string;
|
||||
isAdmin: boolean;
|
||||
isEditor: boolean;
|
||||
createdAt: Date;
|
||||
};
|
||||
};
|
||||
|
||||
const { withAuth } = createAuth({
|
||||
listKey: "User",
|
||||
identityField: "email",
|
||||
|
||||
sessionData: "id name createdAt isAdmin isEditor",
|
||||
secretField: "password",
|
||||
|
||||
initFirstItem: {
|
||||
fields: ["name", "email", "password", "isAdmin"],
|
||||
},
|
||||
});
|
||||
|
||||
const sessionMaxAge = 60 * 60 * 24 * 30;
|
||||
|
||||
const session = statelessSessions({
|
||||
maxAge: sessionMaxAge,
|
||||
secret: sessionSecret!,
|
||||
});
|
||||
|
||||
export { withAuth, session };
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd /app;
|
||||
npm install;
|
||||
npx prisma db push;
|
||||
npm run start;
|
@ -1,41 +0,0 @@
|
||||
import { config } from "@keystone-6/core";
|
||||
|
||||
import { lists } from "./schema";
|
||||
|
||||
import { withAuth, session } from "./auth";
|
||||
import { DatabaseProvider } from "@keystone-6/core/types";
|
||||
|
||||
const baseUrl = process.env.BASE_URL ?? "http://localhost:3000";
|
||||
const databaseUrl = process.env.DATABASE_URL ?? "postgresql://postgres:password@127.0.0.1:5432/capital";
|
||||
const databaseProvider = process.env.DATABASE_PROVIDER ?? "postgresql";
|
||||
|
||||
export default withAuth(
|
||||
config({
|
||||
ui: {
|
||||
basePath: "/cms",
|
||||
},
|
||||
db: {
|
||||
provider: databaseProvider as DatabaseProvider,
|
||||
url: databaseUrl,
|
||||
},
|
||||
server: {
|
||||
cors: {
|
||||
origin: "*",
|
||||
methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
|
||||
},
|
||||
},
|
||||
storage: {
|
||||
localImages: {
|
||||
kind: "local",
|
||||
type: "image",
|
||||
generateUrl: (path) => `${baseUrl}/images${path}`,
|
||||
serverRoute: {
|
||||
path: "/images",
|
||||
},
|
||||
storagePath: "public/images",
|
||||
},
|
||||
},
|
||||
lists,
|
||||
session,
|
||||
}),
|
||||
);
|
@ -1,28 +0,0 @@
|
||||
const isUser = ({ session }: { session: any }) => session?.data.id != null;
|
||||
const allowUser: any = {
|
||||
operation: {
|
||||
create: isUser,
|
||||
update: isUser,
|
||||
delete: isUser,
|
||||
},
|
||||
};
|
||||
|
||||
const isEditor = ({ session }: { session: any }) => session?.data.isEditor || session?.data.isAdmin;
|
||||
const allowEditor: any = {
|
||||
operation: {
|
||||
create: isEditor,
|
||||
update: isEditor,
|
||||
delete: isEditor,
|
||||
},
|
||||
};
|
||||
|
||||
const isAdmin = ({ session }: { session: any }) => session?.data.isAdmin;
|
||||
const allowAdmin: any = {
|
||||
operation: {
|
||||
create: isAdmin,
|
||||
update: isAdmin,
|
||||
delete: isAdmin,
|
||||
},
|
||||
};
|
||||
|
||||
export { isUser, isAdmin, isEditor, allowUser, allowAdmin, allowEditor };
|
11019
content/package-lock.json
generated
11019
content/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "keystone-app",
|
||||
"version": "1.0.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "keystone dev",
|
||||
"start": "keystone start",
|
||||
"build": "keystone build",
|
||||
"postinstall": "keystone build --no-ui --frozen"
|
||||
},
|
||||
"dependencies": {
|
||||
"@keystone-6/auth": "^7.0.0",
|
||||
"@keystone-6/core": "^5.0.0",
|
||||
"@keystone-6/fields-document": "^7.0.0",
|
||||
"typescript": "^4.9.5"
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 MiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 MiB |
File diff suppressed because it is too large
Load Diff
@ -1,155 +0,0 @@
|
||||
// This file is automatically generated by Keystone, do not modify it manually.
|
||||
// Modify your Keystone config when you want to change this.
|
||||
|
||||
datasource postgresql {
|
||||
url = env("DATABASE_URL")
|
||||
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
|
||||
provider = "postgresql"
|
||||
}
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String @default("")
|
||||
email String @unique @default("")
|
||||
password String
|
||||
posts Post[] @relation("Post_author")
|
||||
moments Moment[] @relation("Moment_author")
|
||||
events Event[] @relation("Event_author")
|
||||
isAdmin Boolean @default(false)
|
||||
isEditor Boolean @default(false)
|
||||
createdAt DateTime? @default(now())
|
||||
}
|
||||
|
||||
model Image {
|
||||
id String @id @default(cuid())
|
||||
caption String @default("")
|
||||
image_filesize Int?
|
||||
image_extension String?
|
||||
image_width Int?
|
||||
image_height Int?
|
||||
image_id String?
|
||||
createdAt DateTime? @default(now())
|
||||
from_Post_cover Post[] @relation("Post_cover")
|
||||
from_Post_images Post[] @relation("Post_images")
|
||||
from_Moment_images Moment[] @relation("Moment_images")
|
||||
from_Project_icon Project[] @relation("Project_icon")
|
||||
}
|
||||
|
||||
model Asset {
|
||||
id String @id @default(cuid())
|
||||
caption String @default("")
|
||||
url String @default("")
|
||||
type AssetTypeType @default(video) @map("media_type")
|
||||
createdAt DateTime? @default(now())
|
||||
from_Post_assets Post[] @relation("Post_assets")
|
||||
}
|
||||
|
||||
model Post {
|
||||
id String @id @default(cuid())
|
||||
slug String @unique @default("")
|
||||
title String @default("")
|
||||
cover Image? @relation("Post_cover", fields: [coverId], references: [id])
|
||||
coverId String? @map("cover")
|
||||
description String @default("")
|
||||
assets Asset[] @relation("Post_assets")
|
||||
images Image[] @relation("Post_images")
|
||||
content Json @default("[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"}]}]")
|
||||
type PostTypeType @default(article) @map("post_type")
|
||||
isPublished Boolean @default(false)
|
||||
author User? @relation("Post_author", fields: [authorId], references: [id])
|
||||
authorId String? @map("author")
|
||||
categories Category[] @relation("Category_posts")
|
||||
tags Tag[] @relation("Post_tags")
|
||||
createdAt DateTime? @default(now())
|
||||
from_Project_post Project[] @relation("Project_post")
|
||||
|
||||
@@index([coverId])
|
||||
@@index([authorId])
|
||||
}
|
||||
|
||||
model Moment {
|
||||
id String @id @default(cuid())
|
||||
title String @default("")
|
||||
images Image[] @relation("Moment_images")
|
||||
content Json @default("[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"}]}]")
|
||||
author User? @relation("Moment_author", fields: [authorId], references: [id])
|
||||
authorId String? @map("author")
|
||||
categories Category[] @relation("Category_moments")
|
||||
tags Tag[] @relation("Moment_tags")
|
||||
createdAt DateTime? @default(now())
|
||||
|
||||
@@index([authorId])
|
||||
}
|
||||
|
||||
model Project {
|
||||
id String @id @default(cuid())
|
||||
icon Image? @relation("Project_icon", fields: [iconId], references: [id])
|
||||
iconId String? @map("icon")
|
||||
name String @default("")
|
||||
description String @default("")
|
||||
link String @default("")
|
||||
isPublished Boolean @default(false)
|
||||
status ProjectStatusType @default(pending) @map("project_status")
|
||||
post Post? @relation("Project_post", fields: [postId], references: [id])
|
||||
postId String? @map("post")
|
||||
createdAt DateTime? @default(now())
|
||||
|
||||
@@index([iconId])
|
||||
@@index([postId])
|
||||
}
|
||||
|
||||
model Event {
|
||||
id String @id @default(cuid())
|
||||
slug String @unique @default("")
|
||||
title String @default("")
|
||||
description String @default("")
|
||||
content Json @default("[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"}]}]")
|
||||
isPublished Boolean @default(false)
|
||||
isHistory Boolean @default(false)
|
||||
author User? @relation("Event_author", fields: [authorId], references: [id])
|
||||
authorId String? @map("author")
|
||||
categories Category[] @relation("Category_events")
|
||||
tags Tag[] @relation("Event_tags")
|
||||
createdAt DateTime? @default(now())
|
||||
|
||||
@@index([authorId])
|
||||
}
|
||||
|
||||
model Category {
|
||||
id String @id @default(cuid())
|
||||
slug String @unique @default("")
|
||||
name String @default("")
|
||||
posts Post[] @relation("Category_posts")
|
||||
moments Moment[] @relation("Category_moments")
|
||||
events Event[] @relation("Category_events")
|
||||
}
|
||||
|
||||
model Tag {
|
||||
id String @id @default(cuid())
|
||||
slug String @unique @default("")
|
||||
name String @default("")
|
||||
posts Post[] @relation("Post_tags")
|
||||
moments Moment[] @relation("Moment_tags")
|
||||
events Event[] @relation("Event_tags")
|
||||
}
|
||||
|
||||
enum AssetTypeType {
|
||||
video
|
||||
audio
|
||||
}
|
||||
|
||||
enum PostTypeType {
|
||||
article
|
||||
podcast
|
||||
}
|
||||
|
||||
enum ProjectStatusType {
|
||||
pending
|
||||
constructing
|
||||
published
|
||||
abandoned
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
import { image, select, text, timestamp } from "@keystone-6/core/fields";
|
||||
import { list } from "@keystone-6/core";
|
||||
|
||||
import { allowEditor } from "../limit";
|
||||
|
||||
export const Image = list({
|
||||
access: allowEditor,
|
||||
|
||||
fields: {
|
||||
caption: text(),
|
||||
image: image({ storage: "localImages" }),
|
||||
|
||||
createdAt: timestamp({
|
||||
defaultValue: { kind: "now" },
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
export const Asset = list({
|
||||
access: allowEditor,
|
||||
|
||||
fields: {
|
||||
caption: text(),
|
||||
url: text({ validation: { isRequired: true } }),
|
||||
type: select({
|
||||
type: "enum",
|
||||
options: [
|
||||
{ label: "Video", value: "video" },
|
||||
{ label: "Audio", value: "audio" },
|
||||
],
|
||||
defaultValue: "video",
|
||||
db: { map: "media_type" },
|
||||
validation: { isRequired: true },
|
||||
ui: { displayMode: "select" },
|
||||
}),
|
||||
|
||||
createdAt: timestamp({
|
||||
defaultValue: { kind: "now" },
|
||||
}),
|
||||
},
|
||||
});
|
@ -1,37 +0,0 @@
|
||||
import { list } from "@keystone-6/core";
|
||||
import { allowEditor } from "../limit";
|
||||
import { relationship, text } from "@keystone-6/core/fields";
|
||||
|
||||
export const Category = list({
|
||||
access: allowEditor,
|
||||
|
||||
fields: {
|
||||
slug: text({
|
||||
validation: {
|
||||
isRequired: true,
|
||||
},
|
||||
isIndexed: "unique",
|
||||
}),
|
||||
name: text(),
|
||||
posts: relationship({ ref: "Post.categories", many: true }),
|
||||
moments: relationship({ ref: "Moment.categories", many: true }),
|
||||
events: relationship({ ref: "Event.categories", many: true }),
|
||||
},
|
||||
});
|
||||
|
||||
export const Tag = list({
|
||||
access: allowEditor,
|
||||
|
||||
fields: {
|
||||
slug: text({
|
||||
validation: {
|
||||
isRequired: true,
|
||||
},
|
||||
isIndexed: "unique",
|
||||
}),
|
||||
name: text(),
|
||||
posts: relationship({ ref: "Post.tags", many: true }),
|
||||
moments: relationship({ ref: "Moment.tags", many: true }),
|
||||
events: relationship({ ref: "Event.tags", many: true }),
|
||||
},
|
||||
});
|
@ -1,89 +0,0 @@
|
||||
import { checkbox, relationship, text, timestamp } from "@keystone-6/core/fields";
|
||||
import { document } from "@keystone-6/fields-document";
|
||||
import { list } from "@keystone-6/core";
|
||||
import { allowEditor } from "../limit";
|
||||
import { Session } from "../auth";
|
||||
|
||||
export const Event = list({
|
||||
access: {
|
||||
...allowEditor,
|
||||
|
||||
filter: {
|
||||
query: ({ session }: { session: Session }) => {
|
||||
if (session?.data.isEditor || session?.data.isAdmin) return true;
|
||||
return { isPublished: { equals: true } };
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
fields: {
|
||||
slug: text({
|
||||
validation: {
|
||||
isRequired: true,
|
||||
},
|
||||
isIndexed: "unique",
|
||||
}),
|
||||
title: text({ validation: { isRequired: true } }),
|
||||
description: text(),
|
||||
|
||||
content: document({
|
||||
formatting: true,
|
||||
layouts: [
|
||||
[1, 1],
|
||||
[1, 1, 1],
|
||||
[2, 1],
|
||||
[1, 2],
|
||||
[1, 2, 1],
|
||||
],
|
||||
links: true,
|
||||
dividers: true,
|
||||
}),
|
||||
|
||||
isPublished: checkbox(),
|
||||
isHistory: checkbox(),
|
||||
|
||||
author: relationship({
|
||||
ref: "User.events",
|
||||
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name", "email"],
|
||||
inlineEdit: { fields: ["name", "email"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
},
|
||||
|
||||
many: false,
|
||||
}),
|
||||
|
||||
categories: relationship({
|
||||
ref: "Category.events",
|
||||
many: true,
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name"],
|
||||
inlineEdit: { fields: ["name"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
inlineCreate: { fields: ["name"] },
|
||||
},
|
||||
}),
|
||||
|
||||
tags: relationship({
|
||||
ref: "Tag.events",
|
||||
many: true,
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name"],
|
||||
inlineEdit: { fields: ["name"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
inlineCreate: { fields: ["name"] },
|
||||
},
|
||||
}),
|
||||
|
||||
createdAt: timestamp({
|
||||
defaultValue: { kind: "now" },
|
||||
}),
|
||||
},
|
||||
});
|
@ -1,49 +0,0 @@
|
||||
import { list } from "@keystone-6/core";
|
||||
|
||||
import { text, relationship, password, timestamp, checkbox } from "@keystone-6/core/fields";
|
||||
|
||||
import { allowAdmin } from "../limit";
|
||||
|
||||
import { Image, Asset } from "./assets";
|
||||
import { Moment } from "./moments";
|
||||
import { Category, Tag } from "./categories";
|
||||
import { Project } from "./projects";
|
||||
import { Post } from "./posts";
|
||||
import { Event } from "./events";
|
||||
|
||||
export const lists = {
|
||||
User: list({
|
||||
access: allowAdmin,
|
||||
|
||||
fields: {
|
||||
name: text({ validation: { isRequired: true } }),
|
||||
email: text({
|
||||
validation: { isRequired: true },
|
||||
isIndexed: "unique",
|
||||
}),
|
||||
|
||||
password: password({ validation: { isRequired: true } }),
|
||||
posts: relationship({ ref: "Post.author", many: true }),
|
||||
moments: relationship({ ref: "Moment.author", many: true }),
|
||||
events: relationship({ ref: "Event.author", many: true }),
|
||||
|
||||
isAdmin: checkbox(),
|
||||
isEditor: checkbox(),
|
||||
|
||||
createdAt: timestamp({
|
||||
defaultValue: { kind: "now" },
|
||||
}),
|
||||
},
|
||||
}),
|
||||
|
||||
Image,
|
||||
Asset,
|
||||
|
||||
Post,
|
||||
Moment,
|
||||
Project,
|
||||
Event,
|
||||
|
||||
Category,
|
||||
Tag,
|
||||
};
|
@ -1,70 +0,0 @@
|
||||
import { list } from "@keystone-6/core";
|
||||
import { allowUser } from "../limit";
|
||||
import { document } from "@keystone-6/fields-document";
|
||||
import { relationship, text, timestamp } from "@keystone-6/core/fields";
|
||||
|
||||
export const Moment = list({
|
||||
access: allowUser,
|
||||
|
||||
fields: {
|
||||
title: text({ validation: { isRequired: true } }),
|
||||
images: relationship({ ref: "Image", many: true }),
|
||||
|
||||
content: document({
|
||||
formatting: true,
|
||||
layouts: [
|
||||
[1, 1],
|
||||
[1, 1, 1],
|
||||
[2, 1],
|
||||
[1, 2],
|
||||
[1, 2, 1],
|
||||
],
|
||||
links: true,
|
||||
dividers: true,
|
||||
}),
|
||||
|
||||
author: relationship({
|
||||
ref: "User.moments",
|
||||
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name", "email"],
|
||||
inlineEdit: { fields: ["name", "email"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
},
|
||||
|
||||
many: false,
|
||||
}),
|
||||
|
||||
categories: relationship({
|
||||
ref: "Category.moments",
|
||||
many: true,
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name"],
|
||||
inlineEdit: { fields: ["name"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
inlineCreate: { fields: ["name"] },
|
||||
},
|
||||
}),
|
||||
|
||||
tags: relationship({
|
||||
ref: "Tag.moments",
|
||||
many: true,
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name"],
|
||||
inlineEdit: { fields: ["name"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
inlineCreate: { fields: ["name"] },
|
||||
},
|
||||
}),
|
||||
|
||||
createdAt: timestamp({
|
||||
defaultValue: { kind: "now" },
|
||||
}),
|
||||
},
|
||||
});
|
@ -1,104 +0,0 @@
|
||||
import { checkbox, relationship, select, text, timestamp } from "@keystone-6/core/fields";
|
||||
import { document } from "@keystone-6/fields-document";
|
||||
import { list } from "@keystone-6/core";
|
||||
import { allowEditor } from "../limit";
|
||||
import { Session } from "../auth";
|
||||
|
||||
export const Post = list({
|
||||
access: {
|
||||
...allowEditor,
|
||||
|
||||
filter: {
|
||||
query: ({ session }: { session: Session }) => {
|
||||
if (session?.data.isEditor || session?.data.isAdmin) return true;
|
||||
return { isPublished: { equals: true } };
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
fields: {
|
||||
slug: text({
|
||||
validation: {
|
||||
isRequired: true,
|
||||
},
|
||||
isIndexed: "unique",
|
||||
}),
|
||||
title: text({ validation: { isRequired: true } }),
|
||||
cover: relationship({ ref: "Image" }),
|
||||
|
||||
description: text(),
|
||||
|
||||
assets: relationship({ ref: "Asset", many: true }),
|
||||
images: relationship({ ref: "Image", many: true }),
|
||||
content: document({
|
||||
formatting: true,
|
||||
layouts: [
|
||||
[1, 1],
|
||||
[1, 1, 1],
|
||||
[2, 1],
|
||||
[1, 2],
|
||||
[1, 2, 1],
|
||||
],
|
||||
links: true,
|
||||
dividers: true,
|
||||
}),
|
||||
|
||||
type: select({
|
||||
type: "enum",
|
||||
options: [
|
||||
{ label: "Article", value: "article" },
|
||||
{ label: "Podcast", value: "podcast" },
|
||||
],
|
||||
defaultValue: "article",
|
||||
db: { map: "post_type" },
|
||||
validation: { isRequired: true },
|
||||
ui: { displayMode: "select" },
|
||||
}),
|
||||
|
||||
isPublished: checkbox(),
|
||||
|
||||
author: relationship({
|
||||
ref: "User.posts",
|
||||
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name", "email"],
|
||||
inlineEdit: { fields: ["name", "email"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
},
|
||||
|
||||
many: false,
|
||||
}),
|
||||
|
||||
categories: relationship({
|
||||
ref: "Category.posts",
|
||||
many: true,
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name"],
|
||||
inlineEdit: { fields: ["name"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
inlineCreate: { fields: ["name"] },
|
||||
},
|
||||
}),
|
||||
|
||||
tags: relationship({
|
||||
ref: "Tag.posts",
|
||||
many: true,
|
||||
ui: {
|
||||
displayMode: "cards",
|
||||
cardFields: ["name"],
|
||||
inlineEdit: { fields: ["name"] },
|
||||
linkToItem: true,
|
||||
inlineConnect: true,
|
||||
inlineCreate: { fields: ["name"] },
|
||||
},
|
||||
}),
|
||||
|
||||
createdAt: timestamp({
|
||||
defaultValue: { kind: "now" },
|
||||
}),
|
||||
},
|
||||
});
|
@ -1,46 +0,0 @@
|
||||
import { checkbox, relationship, select, text, timestamp } from "@keystone-6/core/fields";
|
||||
import { list } from "@keystone-6/core";
|
||||
import { allowAdmin } from "../limit";
|
||||
import { Session } from "../auth";
|
||||
|
||||
export const Project = list({
|
||||
access: {
|
||||
...allowAdmin,
|
||||
|
||||
filter: {
|
||||
query: ({ session }: { session: Session }) => {
|
||||
if (session?.data.isEditor || session?.data.isAdmin) return true;
|
||||
return { isPublished: { equals: true } };
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
fields: {
|
||||
icon: relationship({ ref: "Image" }),
|
||||
name: text({ validation: { isRequired: true } }),
|
||||
description: text(),
|
||||
link: text(),
|
||||
|
||||
isPublished: checkbox(),
|
||||
|
||||
status: select({
|
||||
type: "enum",
|
||||
options: [
|
||||
{ label: "Pending", value: "pending" },
|
||||
{ label: "Constructing", value: "constructing" },
|
||||
{ label: "Published", value: "published" },
|
||||
{ label: "Abandoned", value: "abandoned" },
|
||||
],
|
||||
defaultValue: "pending",
|
||||
db: { map: "project_status" },
|
||||
validation: { isRequired: true },
|
||||
ui: { displayMode: "select" },
|
||||
}),
|
||||
|
||||
post: relationship({ ref: "Post" }),
|
||||
|
||||
createdAt: timestamp({
|
||||
defaultValue: { kind: "now" },
|
||||
}),
|
||||
},
|
||||
});
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "commonjs",
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user