This commit is contained in:
NAME
2026-05-23 07:26:01 +00:00
parent 9599022c44
commit 9e8c7874df
3 changed files with 18 additions and 1 deletions
+8
View File
@@ -1,6 +1,7 @@
import {Injectable} from "@nestjs/common";
import {PrismaService} from "../../prisma/prisma.service";
import {Post, Prisma} from "../generated/prisma/client";
import {_toNum} from "./helper";
@Injectable()
export class PgPostService {
@@ -18,6 +19,13 @@ export class PgPostService {
}
async createPost(data: Prisma.PostCreateInput): Promise<Post> {
if(_toNum(process.env.X_NEWS_ALLOW_SAVE_POST_CONTENT) != 1) {
console.error('Not allow save ..');
// @ts-ignore
return {
id: 0
};
}
return this.prisma.post.create({
data,
});