@@ -20,6 +20,8 @@ import {
2020import PQueue from 'p-queue' ;
2121import { generateLuciaPasswordHash } from 'lucia/utils' ;
2222
23+ import { getTaskGrade } from '../src/lib/types/task' ;
24+
2325import { classifyContest } from '../src/lib/utils/contest' ;
2426
2527import { users , USER_PASSWORD_FOR_SEED } from './users' ;
@@ -104,7 +106,12 @@ async function addUsers() {
104106
105107// See:
106108// https://lucia-auth.com/reference/lucia/modules/utils/#generateluciapasswordhash
107- async function addUser ( user , password : string , userFactory , keyFactory ) {
109+ async function addUser (
110+ user : ( typeof users ) [ number ] ,
111+ password : string ,
112+ userFactory : ReturnType < typeof defineUserFactory > ,
113+ keyFactory : ReturnType < typeof defineKeyFactory > ,
114+ ) {
108115 const currentUser = await userFactory . createForConnect ( {
109116 id : user . id ,
110117 username : user . name ,
@@ -150,15 +157,18 @@ async function addTasks() {
150157 console . log ( 'Finished adding tasks.' ) ;
151158}
152159
153- async function addTask ( task , taskFactory ) {
160+ async function addTask (
161+ task : ( typeof tasks ) [ number ] ,
162+ taskFactory : ReturnType < typeof defineTaskFactory > ,
163+ ) {
154164 // Note: Task-Tag relationships are handled separately via TaskTag table
155165 await taskFactory . create ( {
156166 contest_type : classifyContest ( task . contest_id ) ,
157167 contest_id : task . contest_id ,
158168 task_table_index : task . problem_index ,
159169 task_id : task . id ,
160170 title : task . title ,
161- grade : task . grade ,
171+ grade : getTaskGrade ( task . grade as string ) ,
162172 } ) ;
163173}
164174
@@ -223,7 +233,10 @@ async function addWorkBooks() {
223233 console . log ( 'Finished adding workbooks.' ) ;
224234}
225235
226- async function addWorkBook ( workbook , workBookFactory ) {
236+ async function addWorkBook (
237+ workbook : ( typeof workbooks ) [ number ] ,
238+ workBookFactory : ReturnType < typeof defineWorkBookFactory > ,
239+ ) {
227240 const urlSlug = normalizeUrlSlug ( workbook . urlSlug ) ;
228241
229242 await workBookFactory . create ( {
@@ -293,7 +306,7 @@ async function addTags() {
293306 console . log ( 'Finished adding tags.' ) ;
294307}
295308
296- async function addTag ( tag , tagFactory ) {
309+ async function addTag ( tag : ( typeof tags ) [ number ] , tagFactory : ReturnType < typeof defineTagFactory > ) {
297310 // Note: Tags and Tasks are connected via the TaskTag relationship table
298311 // which is handled separately in addTaskTags()
299312 await tagFactory . create ( {
@@ -353,7 +366,10 @@ async function addTaskTags() {
353366 await taskTagQueue . onIdle ( ) ; // Wait for all task tags to complete
354367 console . log ( 'Finished adding task tags.' ) ;
355368}
356- async function addTaskTag ( task_tag , taskTagFactory ) {
369+ async function addTaskTag (
370+ task_tag : ( typeof task_tags ) [ number ] ,
371+ taskTagFactory : ReturnType < typeof defineTaskTagFactory > ,
372+ ) {
357373 await taskTagFactory . create ( {
358374 id : task_tag . id ,
359375 priority : task_tag . priority ,
@@ -398,7 +414,10 @@ async function addSubmissionStatuses() {
398414 console . log ( 'Finished adding submission statuses.' ) ;
399415}
400416
401- async function addSubmissionStatus ( submission_status , submissionStatusFactory ) {
417+ async function addSubmissionStatus (
418+ submission_status : ( typeof submission_statuses ) [ number ] ,
419+ submissionStatusFactory : ReturnType < typeof defineSubmissionStatusFactory > ,
420+ ) {
402421 await submissionStatusFactory . create ( {
403422 id : submission_status . id ,
404423 status_name : submission_status . status_name ,
@@ -460,7 +479,10 @@ async function addAnswers() {
460479 console . log ( 'Finished adding answers.' ) ;
461480}
462481
463- async function addAnswer ( answer , taskAnswerFactory ) {
482+ async function addAnswer (
483+ answer : ( typeof answers ) [ number ] ,
484+ taskAnswerFactory : ReturnType < typeof defineTaskAnswerFactory > ,
485+ ) {
464486 await taskAnswerFactory . create ( {
465487 id : answer . id ,
466488 task : {
0 commit comments