diff --git a/server/controllers/analytic.ts b/server/controllers/analytic.ts index a8128eac9..cb1232ce6 100644 --- a/server/controllers/analytic.ts +++ b/server/controllers/analytic.ts @@ -282,8 +282,6 @@ analyticController.router.post( AppDataSource.getRepository(User).createQueryBuilder('user').select('user.firstlogin').where({ id: data.userId }).getRawOne(), ]); - console.log('User Phase in analytics', userPhase); - if (sessionCount === 0 && data.event === 'pageview' && data.params?.isInitial) { const session = new AnalyticSession(); session.id = data.sessionId; diff --git a/src/api/statistics/statistics.get.ts b/src/api/statistics/statistics.get.ts index af7002da9..77c05ee66 100644 --- a/src/api/statistics/statistics.get.ts +++ b/src/api/statistics/statistics.get.ts @@ -1,52 +1,3 @@ -// import { useQuery } from 'react-query'; - -// import { mockClassroomsStats, mockConnectionsStats } from 'src/components/admin/dashboard-statistics/mocks/mocks'; -// import { axiosRequest } from 'src/utils/axiosRequest'; -// import type { ClassroomsStats, ConnectionsStats } from 'types/statistics.type'; - -// const isDevelopment = process.env.NODE_ENV === 'development'; - -// async function getClassroomsStats(): Promise { -// if (isDevelopment) { -// // retourne mocks -// return new Promise((resolve) => { -// setTimeout(() => resolve(mockClassroomsStats), 500); -// }); -// } - -// return ( -// await axiosRequest({ -// method: 'GET', -// baseURL: '/api', -// url: '/statistics/classrooms', -// }) -// ).data; -// } - -// export const useGetClassroomsStats = () => { -// return useQuery(['classrooms-stats'], getClassroomsStats); -// }; - -// async function getConnectionsStats(): Promise { -// if (isDevelopment) { -// return new Promise((resolve) => { -// setTimeout(() => resolve(mockConnectionsStats), 500); -// }); -// } - -// return ( -// await axiosRequest({ -// method: 'GET', -// baseURL: '/api', -// url: '/statistics/connections', -// }) -// ).data; -// } - -// export const useGetConnectionsStats = () => { -// return useQuery(['connections-stats'], getConnectionsStats); -// }; - import { useQuery } from 'react-query'; import { axiosRequest } from 'src/utils/axiosRequest'; diff --git a/src/api/teamComment/teamComment.get.ts b/src/api/teamComment/teamComment.get.ts new file mode 100644 index 000000000..83bdc5fe8 --- /dev/null +++ b/src/api/teamComment/teamComment.get.ts @@ -0,0 +1,18 @@ +import { useQuery } from 'react-query'; + +import { axiosRequest } from 'src/utils/axiosRequest'; +import type { TeamCommentInterface } from 'types/teamComment.type'; + +async function getTeamComments(): Promise { + return ( + await axiosRequest({ + method: 'GET', + baseURL: '/api', + url: '/statistics/team-comments', + }) + ).data; +} + +export const useGetSessionsStats = () => { + return useQuery(['team-comments'], () => getTeamComments()); +}; diff --git a/types/teamComment.type.ts b/types/teamComment.type.ts index 7cf8e01b9..75211fb4e 100644 --- a/types/teamComment.type.ts +++ b/types/teamComment.type.ts @@ -1,6 +1,6 @@ export interface TeamCommentInterface { id: number; - type: number; + type: TeamCommentType; createDate?: Date | string; updateDate?: Date | string; text: string;