Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument renaming #456

Open
katconnors opened this issue Oct 22, 2024 · 1 comment
Open

Argument renaming #456

katconnors opened this issue Oct 22, 2024 · 1 comment

Comments

@katconnors
Copy link
Contributor

katconnors commented Oct 22, 2024

Argument renaming in backend/routers for clarity (note that the original comment references case_manager, but naming is also in the para file as well)- see comment below from PR #433:

"This is a lot of arguments, whose values don't look like the names of the parameters. Can we consider changing this function to take keyword arguments, so that it's clear for example that req.ctx.auth.session.user?.name ?? "" is being fed as case_manager_name?"

Originally posted by @canjalal in #433 (comment)

@canjalal
Copy link
Contributor

Where I was working last time, once we had over 3 arguments, we used keyword arguments, like this:

const newCourse = await CoursesRepopsitory.create({
  gradeIds: values.grades,
  name: values.courseName,
  schoolId: values.teacherMemeberships?.value,
  subjectIds: values.usbbjects,
});

where CoursesRepository.create is defined as:

interface NewCourseData {
  gradeIds: number[];
  name: string;
  schoolId: number;
  subjectids:number[];
}

class CoursesRepository {
  static async create({
    gradeIds,
    name,
    schoolId,
    subjectIds,
  }: NewCourseData): Promise<CourseWithGradeAndSubjectData | void> {
...

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

No branches or pull requests

2 participants