File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 7
7
8
8
CloudinaryUploadResult ,
9
9
} from "@/interface" ;
10
- import Paper from "@/db/papers" ;
10
+ import { PaperAdmin } from "@/db/papers" ;
11
11
// TODO: REMOVE THUMBNAIL FROM admin-buffer DB
12
12
cloudinary . v2 . config ( {
13
13
cloud_name : process . env . NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME ,
@@ -65,7 +65,7 @@ export async function POST(req: Request) {
65
65
. replace ( "pdf" , "jpg" )
66
66
. replace ( "upload" , "upload/w_400,h_400,c_fill" )
67
67
. replace ( / < i m g s r c = ' | ' \s * \/ > / g, "" ) ;
68
- const paper = new Paper ( {
68
+ const paper = new PaperAdmin ( {
69
69
70
70
public_id_cloudinary,
71
71
finalUrl,
Original file line number Diff line number Diff line change @@ -12,7 +12,12 @@ const paperSchema = new Schema<IPaper>({
12
12
isSelected : { type : Boolean , default : false } ,
13
13
} ) ;
14
14
15
+ paperSchema . index ( { subject : 1 } ) ;
16
+
17
+ export const PaperAdmin : Model < IPaper > =
18
+ mongoose . models . Admin ?? mongoose . model < IPaper > ( "Admin" , paperSchema ) ;
15
19
const Paper : Model < IPaper > =
16
- mongoose . models . paper ?? mongoose . model < IPaper > ( "paper " , paperSchema ) ;
20
+ mongoose . models . Paper ?? mongoose . model < IPaper > ( "Paper " , paperSchema ) ;
17
21
18
22
export default Paper ;
23
+
You can’t perform that action at this time.
0 commit comments