Calendar service->main#284
Conversation
…ogin_token_partB connect google calander
…ogin_token_partB changes
…ogin_token_partB Task 27 b saving calendar login token part b
…h/sola into Calendar_Service_Dev
Calendar service dev
…h/sola into Calendar_Service_Dev
…ogin_token Task 27 b saving calendar login token
Calendar Service Dev->calendar_Service
| res.status(HttpStatusCode.OK).json({ | ||
| IsSucceeded: true, | ||
| statusCode: HttpStatusCode.OK, | ||
| message: "Connection to Google Calendar was successful! You can close the window." |
There was a problem hiding this comment.
Please consult AI, I feel something is not accurate in this sentence
| default: | ||
| return res.status(500).json({ message: "Internal server error." }); | ||
| } | ||
| next(err); |
| } | ||
| } | ||
| export async function syncCalendar(req: Request, res: Response) { | ||
| const bedgNumber = Number(req.query.userID); |
There was a problem hiding this comment.
badgeNumber (pleach ensure I'm correct)
| import { Request, Response, NextFunction } from 'express'; | ||
|
|
||
|
|
||
| export class AppCalendarError extends Error { |
There was a problem hiding this comment.
The class name is a bit unclear. Please consult AI
| }; | ||
|
|
||
| export const generateGoogleAuthUrl = (state: string, employee_email: string): string => { | ||
| export const initializeAuthSession = async (employeeEmail: string, state: string): Promise<string> => { |
There was a problem hiding this comment.
Function taht insert data to database should be named accordingly.
You can rename this function maybe, but the best option (I think) is to extract just lines 16- 28 to separate function
| if (isPersonal) return 'Frontal personal meeting'; | ||
| return 'Frontal team meeting'; | ||
| if (isOnline && isPersonal) return MeetingType.ONLINE_PERSONAL_MEETING; | ||
| if (isOnline) return MeetingType.ONLINE_TEAM_MEETING; |
| return MeetingType.FRONTAL_TEAM_MEETING; | ||
| } | ||
|
|
||
| function mapEventToMeeting(event: any, badgeNumber: number): Meeting | null { |
There was a problem hiding this comment.
Please divide to some functions.
There is a common practice - create a separate service and function for mapping and converting between model and db. Can we implement it here?
| const lastWeek = new Date(); | ||
| lastWeek.setDate(lastWeek.getDate() - 7); | ||
| const nextMonth = new Date(); | ||
| nextMonth.setDate(nextMonth.getDate() + 30); |
There was a problem hiding this comment.
Please create functions for nextMonth.getDate() + 30 and for lastWeek.getDate() - 7). Their name should descibe their goal
| ): Promise<void> { | ||
| const decryptedToken = decryptToken(refreshToken); // פענוח הטוקן | ||
|
|
||
| const { data: user, error: userError } = await supabase |
There was a problem hiding this comment.
Functions that use db should be separated from rest of the logic (maybe even another file and sometimes new layer just for the db connection
add mapper and repository and devide to some functions
update middleware and fix reviews