Skip to content

Commit cc93623

Browse files
committed
♻️ Refactoring (#1124)
1 parent ffaf2de commit cc93623

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

prisma/seed.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,11 @@ async function addWorkBooks() {
177177
id: workbook.authorId,
178178
},
179179
});
180+
// Allow undefined to match empty strings
181+
const normalizedUrlSlug = workbook.urlSlug || undefined;
180182
const registeredWorkBook = await prisma.workBook.findMany({
181183
where: {
182-
urlSlug: workbook.urlSlug,
184+
urlSlug: normalizedUrlSlug,
183185
},
184186
});
185187

prisma/workbooks.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WorkBookType, type WorkBook, type WorkBookTasksBase } from '../src/lib/types/workbook';
1+
import { WorkBookType, type WorkBook } from '../src/lib/types/workbook';
22

33
function createWorkBookBase(overrides: Partial<WorkBook> = {}): WorkBook {
44
return {
@@ -11,16 +11,12 @@ function createWorkBookBase(overrides: Partial<WorkBook> = {}): WorkBook {
1111
isOfficial: false,
1212
isReplenished: false,
1313
workBookType: WorkBookType.CREATED_BY_USER,
14-
urlSlug: '',
15-
workBookTasks: createWorkBookTasks(),
14+
urlSlug: '', // Only include urlSlug when it's explicitly provided
15+
workBookTasks: [],
1616
...overrides,
1717
};
1818
}
1919

20-
function createWorkBookTasks(): WorkBookTasksBase {
21-
return [{ taskId: 'abc322_d', priority: 1, comment: '' }];
22-
}
23-
2420
export const workbooks = [
2521
createWorkBookBase({
2622
title: '標準入出力(1 個の整数)',

0 commit comments

Comments
 (0)