@@ -14,7 +14,7 @@ import type {
14
14
ICourses ,
15
15
CloudinaryUploadResult ,
16
16
ExamDetail ,
17
- Semester ,
17
+ IAdminPaper ,
18
18
} from "@/interface" ;
19
19
import { PaperAdmin } from "@/db/papers" ;
20
20
import axios from "axios" ;
@@ -28,6 +28,7 @@ cloudinary.v2.config({
28
28
api_key : process . env . CLOUDINARY_API_KEY ,
29
29
api_secret : process . env . CLOUDINARY_SECRET ,
30
30
} ) ;
31
+ type SemesterType = IAdminPaper [ "semester" ] ; // Extract the exam type from the IPaper interface
31
32
32
33
export async function POST ( req : Request ) {
33
34
try {
@@ -220,7 +221,7 @@ async function setTagsFromCurrentLists(
220
221
slot : slots [ 0 ] ,
221
222
"course-code" : "notInUse" ,
222
223
"exam-type" : exams [ 0 ] ,
223
- semester : semesters [ 0 ] as Semester ,
224
+ semester : semesters [ 0 ] as SemesterType ,
224
225
year : years [ 0 ] ,
225
226
} ;
226
227
const coursesFuzy = new Fuse ( courses ) ;
@@ -244,7 +245,7 @@ async function setTagsFromCurrentLists(
244
245
}
245
246
const semesterSearchResult = findMatch ( semesters , tags . semester ) ;
246
247
if ( semesterSearchResult ) {
247
- newTags . semester = semesterSearchResult as Semester ;
248
+ newTags . semester = semesterSearchResult as SemesterType ;
248
249
}
249
250
const yearSearchResult = findMatch ( years , tags . year ) ;
250
251
if ( yearSearchResult ) {
0 commit comments