Skip to content

for recreate PR#14

Open
Klay24-Huang wants to merge 12 commits intorefactor/routesfrom
feature/new-shema-re-pr
Open

for recreate PR#14
Klay24-Huang wants to merge 12 commits intorefactor/routesfrom
feature/new-shema-re-pr

Conversation

@Klay24-Huang
Copy link
Collaborator

先前的PR 誤按merge
很抱歉

@Klay24-Huang Klay24-Huang requested a review from swh00tw October 18, 2022 06:06
@swh00tw swh00tw requested a review from jc-hiroto October 18, 2022 06:06
@swh00tw
Copy link
Member

swh00tw commented Oct 18, 2022

標不到 Max,@max 記得來看 xd

Copy link
Member

@swh00tw swh00tw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great. I listed some issues below.

  1. typo
  2. every field should use camelCase
  3. improper naming, ex: ableAddRollNumber (Ambiguous.)
  4. +s when 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({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should handle SQL execution with a try-catch wrapping

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊是neo的api
是排版的時候動到了
是否就保持原樣?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link

@maxchou415 maxchou415 Nov 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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." });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTTP status code 400 cannot indicate the Course not found, it should be either 200 or 404 depending on the exact behaviour.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上則

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is probably caused by eslint & prettier. @Klay24-Huang remember to use 404 in your new repo.

/// 修課限制
// ex: 限學士班二年級以上
// 來自舊系統 NOL table `ifcrfsl`
model Limit {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a better naming for this Limit table since the Limit is meaningful, we will need a specified name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我只能想到叫CourseLimit,這樣會不會太直翻😂

createdAt DateTime @default(now())
}

model LimitTranslation {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to update this name since the Limit will need to be changed.

/// 領域專長代碼
code String @id @db.VarChar(10)
/// 是否通過
apply Boolean

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我會改成isAdmitted
補充一下領域專長的話應該是各系所提出,最後被某個單位審核通過

// 原本於ceiba就有兩種形式
// table office_time_sw.sw
// 為0時,表示為須預約。 為1時,固定時
needReserved Boolean?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about isRequiredAppointment?

courseCollections CourseCollection[]
userInfoTranslations UserInfoTranslation[]
preseletectedCourseTables PreseletectedCourseTable[]
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

想問第三點
是指所有bool type的field都要有預設值嗎
但是這些資料都是從別的資料庫來的
通常都會有值
這樣還有需要default value嗎

name String
/// 組別, 只有學生才有
// ex: 國際關係組
group String?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the dataType be ending in a question mark?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這是prisma當field可以為nullable的寫法

name String
/// 組別, 只有學生才有
// ex: 國際關係組
group String?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這個部份我會再去確認
這邊需要申請學生資料的DB訪問權限
可能沒這麼快

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

剛剛有去確認學生學籍資料庫
我這邊的name是學生名稱
有的學生填基本資料時有填英文名字
或是外籍生有取中文名字

group的話會是 政治系國際關係組 or DEPARTMENT OF POLITICAL SCIENCE, INTERNATIONAL RELATIONS DIVISION 的i18n

/// 教育學程
EducationProgram
/// 夜間部
NightSchool

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ContinuingEducation is the common name for 夜間部. (推廣教育) XD

Copy link

@maxchou415 maxchou415 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request change

departmentId String? @db.VarChar(4)
department Department? @relation(fields: [departmentId], references: [id])
/// 年級
grade Int?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
grade Int?
grade String?

We need to consider "master" and "phD".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants