Conversation
|
標不到 Max,@max 記得來看 xd |
swh00tw
left a comment
There was a problem hiding this comment.
Overall looks great. I listed some issues below.
- typo
- every field should use
camelCase - improper naming, ex:
ableAddRollNumber(Ambiguous.) +swhen it's 1-to-n or m-to-n mapping (I saw you do this, but sometimes you don't. It's inconsistent)
What you should do are correct all the problems I found & check again each line. About improper naming, feel free to let us know on Slack if you don't know how to translate~
| return; | ||
| } | ||
| const course = await prisma.courses.findUnique({ where: { id: course_id } }); | ||
| const course = await prisma.courses.findUnique({ |
There was a problem hiding this comment.
We should handle SQL execution with a try-catch wrapping
There was a problem hiding this comment.
這邊是neo的api
是排版的時候動到了
是否就保持原樣?
There was a problem hiding this comment.
Just leave it. It's okay since you are going to create a new repo in the future.
But remember to wrap SQL execution in try-catch blocks in your new repo.
There was a problem hiding this comment.
My question was "wrapping the SQL execution with try-catch" instead of the change itself. No matter if that is from the Neo API, if there is anything that can be improved, just refactor it right away. Please wrap the SQL execution in the next PR.
| where: { id: course_id }, | ||
| }); | ||
| if (!course) { | ||
| res.status(400).send({ message: "Course not found." }); |
There was a problem hiding this comment.
HTTP status code 400 cannot indicate the Course not found, it should be either 200 or 404 depending on the exact behaviour.
There was a problem hiding this comment.
This change is probably caused by eslint & prettier. @Klay24-Huang remember to use 404 in your new repo.
prisma/new/schema.prisma
Outdated
| /// 修課限制 | ||
| // ex: 限學士班二年級以上 | ||
| // 來自舊系統 NOL table `ifcrfsl` | ||
| model Limit { |
There was a problem hiding this comment.
We need a better naming for this Limit table since the Limit is meaningful, we will need a specified name.
There was a problem hiding this comment.
我只能想到叫CourseLimit,這樣會不會太直翻😂
prisma/new/schema.prisma
Outdated
| createdAt DateTime @default(now()) | ||
| } | ||
|
|
||
| model LimitTranslation { |
There was a problem hiding this comment.
We will need to update this name since the Limit will need to be changed.
prisma/new/schema.prisma
Outdated
| /// 領域專長代碼 | ||
| code String @id @db.VarChar(10) | ||
| /// 是否通過 | ||
| apply Boolean |
There was a problem hiding this comment.
If this field is for marking status with a type boolean, we should use past tense for its naming, for this field, I will suggest isAdmitted as the naming.
Also, the reason for using admitted is - from my understanding, this field marks the status of the application submitted by the student, but please correct me if I am wrong.
There was a problem hiding this comment.
我會改成isAdmitted
補充一下領域專長的話應該是各系所提出,最後被某個單位審核通過
prisma/new/schema.prisma
Outdated
| // 原本於ceiba就有兩種形式 | ||
| // table office_time_sw.sw | ||
| // 為0時,表示為須預約。 為1時,固定時 | ||
| needReserved Boolean? |
| courseCollections CourseCollection[] | ||
| userInfoTranslations UserInfoTranslation[] | ||
| preseletectedCourseTables PreseletectedCourseTable[] | ||
| } |
There was a problem hiding this comment.
We need these fields for better ACL -
1. createdAt - default value should be now(), and not nullable.
2. deletedAt - default value should be null, nullable.
3. isActive - default value can be true.
There was a problem hiding this comment.
想問第三點
是指所有bool type的field都要有預設值嗎
但是這些資料都是從別的資料庫來的
通常都會有值
這樣還有需要default value嗎
| name String | ||
| /// 組別, 只有學生才有 | ||
| // ex: 國際關係組 | ||
| group String? |
There was a problem hiding this comment.
Can the dataType be ending in a question mark?
There was a problem hiding this comment.
這是prisma當field可以為nullable的寫法
| name String | ||
| /// 組別, 只有學生才有 | ||
| // ex: 國際關係組 | ||
| group String? |
There was a problem hiding this comment.
As I remember, the department name is not separating the department name and group name, so I might be - { "name": "政治學系國際關係組" } instead of { "name": "政治學系", "group": "國際關係組" }. Please make sure the data payload before we create it.
There was a problem hiding this comment.
這個部份我會再去確認
這邊需要申請學生資料的DB訪問權限
可能沒這麼快
There was a problem hiding this comment.
剛剛有去確認學生學籍資料庫
我這邊的name是學生名稱
有的學生填基本資料時有填英文名字
或是外籍生有取中文名字
group的話會是 政治系國際關係組 or DEPARTMENT OF POLITICAL SCIENCE, INTERNATIONAL RELATIONS DIVISION 的i18n
| /// 教育學程 | ||
| EducationProgram | ||
| /// 夜間部 | ||
| NightSchool |
There was a problem hiding this comment.
ContinuingEducation is the common name for 夜間部. (推廣教育) XD
prisma/new/schema.prisma
Outdated
| departmentId String? @db.VarChar(4) | ||
| department Department? @relation(fields: [departmentId], references: [id]) | ||
| /// 年級 | ||
| grade Int? |
There was a problem hiding this comment.
| grade Int? | |
| grade String? |
We need to consider "master" and "phD".
先前的PR 誤按merge
很抱歉