Refactor ImportClient component: add pagination, tab switching, and auto-review functionality; remove unused models and scripts
Build and Push Reader Image / docker (push) Failing after 10s

This commit is contained in:
2026-05-01 19:20:19 +07:00
parent 78788c6900
commit 36ecff2725
7 changed files with 67 additions and 196 deletions
-30
View File
@@ -1,30 +0,0 @@
import mongoose, { Schema, Document } from "mongoose"
export interface IChapter extends Document {
novelId: string // Trỏ tới ID trong PostgreSQL
number: number
volumeNumber?: number
volumeTitle?: string
volumeChapterNumber?: number
title: string
content: string
views: number
createdAt: Date
}
const ChapterSchema: Schema = new Schema({
novelId: { type: String, required: true, index: true },
number: { type: Number, required: true },
volumeNumber: { type: Number, default: null },
volumeTitle: { type: String, default: null },
volumeChapterNumber: { type: Number, default: null },
title: { type: String, required: true },
content: { type: String, required: true },
views: { type: Number, default: 0 },
createdAt: { type: Date, default: Date.now },
})
ChapterSchema.index({ novelId: 1, number: 1 }, { unique: true })
ChapterSchema.index({ createdAt: -1, novelId: 1 })
export const Chapter = mongoose.models.Chapter || mongoose.model<IChapter>("Chapter", ChapterSchema)
-25
View File
@@ -1,25 +0,0 @@
import mongoose, { Schema, Document } from "mongoose"
export interface IEditorRecommendation extends Document {
novelId: string
editorId: string
createdAt: Date
updatedAt: Date
}
const EditorRecommendationSchema: Schema = new Schema(
{
novelId: { type: String, required: true, index: true },
editorId: { type: String, required: true, index: true },
},
{
timestamps: true,
}
)
EditorRecommendationSchema.index({ novelId: 1, editorId: 1 }, { unique: true })
EditorRecommendationSchema.index({ createdAt: -1 })
export const EditorRecommendation =
mongoose.models.EditorRecommendation ||
mongoose.model<IEditorRecommendation>("EditorRecommendation", EditorRecommendationSchema)
-25
View File
@@ -1,25 +0,0 @@
import mongoose, { Document, Schema } from "mongoose"
export interface IUserRecommendation extends Document {
userId: string
novelId: string
createdAt: Date
updatedAt: Date
}
const UserRecommendationSchema: Schema = new Schema(
{
userId: { type: String, required: true, index: true },
novelId: { type: String, required: true, index: true },
},
{
timestamps: true,
}
)
UserRecommendationSchema.index({ userId: 1, novelId: 1 }, { unique: true })
UserRecommendationSchema.index({ createdAt: -1 })
export const UserRecommendation =
mongoose.models.UserRecommendation ||
mongoose.model<IUserRecommendation>("UserRecommendation", UserRecommendationSchema)
-39
View File
@@ -1,39 +0,0 @@
import mongoose from "mongoose"
let cached = (global as any).mongoose
if (!cached) {
cached = (global as any).mongoose = { conn: null, promise: null }
}
async function connectToMongoDB() {
const mongodbUri = process.env.MONGODB_URI
if (!mongodbUri) {
throw new Error("Please define the MONGODB_URI environment variable")
}
if (cached.conn) {
return cached.conn
}
if (!cached.promise) {
const opts = {
bufferCommands: false,
}
cached.promise = mongoose.connect(mongodbUri, opts).then((mongoose) => {
return mongoose
})
}
try {
cached.conn = await cached.promise
} catch (e) {
cached.promise = null
throw e
}
return cached.conn
}
export default connectToMongoDB