Skip to content

Commit

Permalink
refactor: refactor maps
Browse files Browse the repository at this point in the history
  • Loading branch information
duncan020313 committed Feb 22, 2024
1 parent fc6690c commit 2028e9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/modules/planners/planners.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class PlannersService {
query,
user,
);
return queryResult.map((p) => toJsonPlanner(p));
return queryResult.map(toJsonPlanner);
}

async getRelatedPlanner(user: session_userprofile) {
Expand Down Expand Up @@ -57,12 +57,12 @@ export class PlannersService {
const valid_end_year = lecture.year <= body.end_year;
return valid_start_year && valid_end_year;
});
valid_taken_lectures.map(async (lecture) => {
valid_taken_lectures.forEach(async (lecture) => {
await this.PlannerRepository.createTakenPlannerItem(planner, lecture);
});
}

body.taken_items_to_copy.map(async (item) => {
body.taken_items_to_copy.forEach(async (item) => {
const target_items = await this.PlannerRepository.getTakenPlannerItemById(
user,
item,
Expand All @@ -79,7 +79,7 @@ export class PlannersService {
}
});

body.future_items_to_copy.map(async (item) => {
body.future_items_to_copy.forEach(async (item) => {
const target_items =
await this.PlannerRepository.getFuturePlannerItemById(user, item);
if (target_items.length == 0) {
Expand All @@ -93,7 +93,7 @@ export class PlannersService {
}
});

body.arbitrary_items_to_copy.map(async (item) => {
body.arbitrary_items_to_copy.forEach(async (item) => {
const target_items =
await this.PlannerRepository.getArbitraryPlannerItemById(user, item);
if (target_items.length == 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/modules/tracks/tracks.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export class TracksService {
const { generalTracks, majorTracks, addtionalTracks } =
await this.TracksRepository.getAllTracks();
return {
general: generalTracks.map((t) => toJsonGeneralTrack(t)),
major: majorTracks.map((t) => toJsonMajorTrack(t)),
additional: addtionalTracks.map((t) => toJsonAdditionalTrack(t)),
general: generalTracks.map(toJsonGeneralTrack),
major: majorTracks.map(toJsonMajorTrack),
additional: addtionalTracks.map(toJsonAdditionalTrack),
};
}
}

0 comments on commit 2028e9b

Please sign in to comment.