From acaceb9237d0c79ad2942fae0c517470bb6f13d2 Mon Sep 17 00:00:00 2001 From: FusiDaniel Date: Thu, 26 Oct 2023 20:30:13 -0300 Subject: [PATCH 01/13] fix: eslint --- packages/tsconfig/base.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/tsconfig/base.json b/packages/tsconfig/base.json index 061c705f..a9ddeb6e 100644 --- a/packages/tsconfig/base.json +++ b/packages/tsconfig/base.json @@ -21,8 +21,7 @@ "allowSyntheticDefaultImports": true, "useDefineForClassFields": true, "sourceMap": true, - "baseUrl": ".", - "allowJs": true + "baseUrl": "." }, "exclude": ["node_modules"] } From 76dc73f4841193c8d3eab3c949ed9a45cda6cde2 Mon Sep 17 00:00:00 2001 From: FusiDaniel Date: Thu, 26 Oct 2023 20:39:07 -0300 Subject: [PATCH 02/13] feat: packages --- packages/consts/index.ts | 12 ++++ packages/consts/package.json | 10 ++++ packages/services/comments.ts | 55 +++++++++++++++---- packages/services/enrollments.ts | 27 +++++++-- packages/services/index.ts | 2 + packages/services/package.json | 3 +- packages/services/reviews.ts | 49 +++++++++++++++++ packages/services/users.ts | 4 +- packages/types/comments.d.ts | 32 +++++++++++ packages/types/concepts.d.ts | 1 + packages/types/index.ts | 7 +++ packages/types/package.json | 10 ++++ packages/types/request-error.d.ts | 6 ++ packages/types/search.d.ts | 18 ++++++ packages/types/subjects.d.ts | 42 ++++++++++++++ packages/types/teachers.d.ts | 50 +++++++++++++++++ packages/types/users.d.ts | 23 ++++++++ packages/utils/index.ts | 3 + packages/utils/package.json | 13 +++++ packages/utils/seasonFormatting.ts | 17 ++++++ .../utils/transformConceptDataToObject.ts | 17 ++++++ packages/utils/transformDataToTimeAgo.ts | 10 ++++ 22 files changed, 392 insertions(+), 19 deletions(-) create mode 100644 packages/consts/index.ts create mode 100644 packages/consts/package.json create mode 100644 packages/services/reviews.ts create mode 100644 packages/types/comments.d.ts create mode 100644 packages/types/concepts.d.ts create mode 100644 packages/types/index.ts create mode 100644 packages/types/package.json create mode 100644 packages/types/request-error.d.ts create mode 100644 packages/types/search.d.ts create mode 100644 packages/types/subjects.d.ts create mode 100644 packages/types/teachers.d.ts create mode 100644 packages/types/users.d.ts create mode 100644 packages/utils/index.ts create mode 100644 packages/utils/package.json create mode 100644 packages/utils/seasonFormatting.ts create mode 100644 packages/utils/transformConceptDataToObject.ts create mode 100644 packages/utils/transformDataToTimeAgo.ts diff --git a/packages/consts/index.ts b/packages/consts/index.ts new file mode 100644 index 00000000..926478fd --- /dev/null +++ b/packages/consts/index.ts @@ -0,0 +1,12 @@ +export const conceptsColor = { + A: '#3FCF8C', + B: '#B8E986', + C: '#F8B74C', + D: '#FFA004', + F: '#F95469', + O: '#A9A9A9', + I: '#1976D2', + E: '#1976D2', + null: '#000000', +}; + diff --git a/packages/consts/package.json b/packages/consts/package.json new file mode 100644 index 00000000..52a779dc --- /dev/null +++ b/packages/consts/package.json @@ -0,0 +1,10 @@ +{ + "name": "consts", + "version": "0.0.0", + "main": "index.ts", + "types": "index.ts", + "license": "MIT", + "publishConfig": { + "access": "public" + } +} diff --git a/packages/services/comments.ts b/packages/services/comments.ts index 56f50e41..420d5a16 100644 --- a/packages/services/comments.ts +++ b/packages/services/comments.ts @@ -1,19 +1,52 @@ + +import { Comment } from 'types'; import api from './api'; -type CommentBody = object; +export type GetCommentResponse = { + data: Comment[]; + total: number; +}; + +export type CreateCommentRequest = { + comment: string, + enrollment: string, + type: string +}; + +type CommentResponse = { + _id: string; + comment: string; + createdAt: string; + enrollment: { _id: string; }; + subject: string; + teacher: string; + updatedAt: string; +} + +export type CreateCommentResponse = CommentResponse + +export type UpdateCommentRequest = { + id: string; + comment: string; +}; + +export type UpdateCommentResponse = CommentResponse const comment = { - get: ( - teacherId: number | string, - subjectId: number | string = '', - params: object, - ) => - api.get('/comments/' + teacherId + '/' + subjectId, { - params, + get: async (teacherId: string, subjectId: string, pageParam = 0) => + api.get(`/comments/${teacherId}/${subjectId}`, { + params: { page: pageParam, limit: 10 }, }), - create: (body: CommentBody) => api.post('/comments/', body), - update: (id: string | number, body: CommentBody) => - api.put('/comments/' + id, body), + getUserComment: async (enrollmentId: string) => api.get(`/comments/enrollment/${enrollmentId}`), + create: async (data: CreateCommentRequest) => api.post('/comments/', data), + update: async ({ id, comment }: UpdateCommentRequest) => + api.put('/comments/' + id, { comment }), + like: async (id: string) => api.post(`/reactions/${id}`, { kind: 'like' }), + recommendation: async (id: string) => + api.post(`/reactions/${id}`, { kind: 'recommendation' }), + removeLike: async (id: string) => api.delete(`/reactions/${id}/like`), + removeRecommendation: async (id: string) => + api.delete(`/reactions/${id}/recommendation`), }; export default comment; diff --git a/packages/services/enrollments.ts b/packages/services/enrollments.ts index ddb58b8a..85e8bd43 100644 --- a/packages/services/enrollments.ts +++ b/packages/services/enrollments.ts @@ -1,6 +1,21 @@ +import { Concept } from 'types'; + import api from './api'; -export type Concept = 'A' | 'B' | 'C' | 'D' | 'F' | 'O'; +type EnrollmentTeacherComment = { + _id: string, + comment: string, + viewers: number, + enrollment: string, + type: string, + ra: string, + active: boolean, + teacher: string, + subject: string, + updatedAt: string, + createdAt: string, + __v: number +} type EnrollmentTeacher = { _id: string; @@ -8,9 +23,10 @@ type EnrollmentTeacher = { updatedAt: string; createdAt: string; __v: number; + comment?: EnrollmentTeacherComment }; -type Subject = { +export type Subject = { _id: string; name: string; search: string; @@ -22,8 +38,8 @@ type Subject = { export type Enrollment = { _id: string; - pratica?: EnrollmentTeacher; - teoria?: EnrollmentTeacher; + pratica?: EnrollmentTeacher | null; + teoria?: EnrollmentTeacher | null; updatedAt: string; conceito: Concept; creditos: number; @@ -31,11 +47,12 @@ export type Enrollment = { quad: number; subject: Subject; year: number; + comments?: string[] }; const enrollment = { list: () => api.get('/enrollments'), - get: (id: string | number) => api.get('/enrollments/' + id), + get: (id: string) => api.get('/enrollments/' + id), }; export default enrollment; diff --git a/packages/services/index.ts b/packages/services/index.ts index 93cc82a3..308176e8 100644 --- a/packages/services/index.ts +++ b/packages/services/index.ts @@ -1,6 +1,8 @@ export { default as Comments } from './comments'; export { default as Enrollments } from './enrollments'; export { default as Users } from './users'; +export { default as Reviews } from './reviews'; export * from './comments'; export * from './enrollments'; export * from './users'; +export * from './reviews'; diff --git a/packages/services/package.json b/packages/services/package.json index b059d7a5..5c825ad0 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -13,6 +13,7 @@ "typescript": "^5.1.6" }, "dependencies": { - "stores": "*" + "stores": "*", + "types": "*" } } diff --git a/packages/services/reviews.ts b/packages/services/reviews.ts new file mode 100644 index 00000000..c0eadfc1 --- /dev/null +++ b/packages/services/reviews.ts @@ -0,0 +1,49 @@ +import { SubjectInfo, TeacherReview } from 'types'; + +import api from './api'; + +export type SearchTeacherItem = { + _id: string; + name: string; + updatedAt?: string; + createdAt?: string; + __v?: number; + alias?: string[]; +}; + +export type SearchTeacher = { + data: SearchTeacherItem[]; + total: number; +}; + +export type SearchSubjectItem = { + _id: string; + name: string; + search: string; + updatedAt: string; + createdAt: string; + __v: number; + creditos: number; +}; + +export type SearchSubject = { + data: SearchSubjectItem[]; + total: number; +}; + +const reviews = { + searchTeachers: async (q: string) => + api.get('/teachers/search', { + params: { q }, + }), + searchSubjects: async (q: string) => + api.get('/subjects/search', { + params: { q }, + }), + getTeacher: async (id: string) => + api.get(`/reviews/teachers/${id}`), + getSubject: async (id: string) => + api.get(`/reviews/subjects/${id}`), +}; + +export default reviews; diff --git a/packages/services/users.ts b/packages/services/users.ts index 4438ddd2..d603d7c7 100644 --- a/packages/services/users.ts +++ b/packages/services/users.ts @@ -1,6 +1,6 @@ import api from './api'; -type Oauth = { +export type Oauth = { email: string; facebook: string; picture: string; @@ -8,7 +8,7 @@ type Oauth = { google?: string; }; -type Device = { +export type Device = { _id: string; deviceId: string; token: string; diff --git a/packages/types/comments.d.ts b/packages/types/comments.d.ts new file mode 100644 index 00000000..7cc4cf1b --- /dev/null +++ b/packages/types/comments.d.ts @@ -0,0 +1,32 @@ +import { Concept } from './concepts'; + +export type Comment = { + _id: string; + comment: string; + createdAt: string; + enrollment: { + _id: string; + conceito: Concept; + creditos: number; + quad: number; + year: number; + season?: string; + }; + myReactions: { + like: boolean; + recommendation: boolean; + star: boolean; + }; + subject: { + __v: number; + _id: string; + createdAt: string; + creditos: number; + name: string; + search: string; + updatedAt: string; + }; + reactionsCount?: { like: number; recommendation: number }; + teacher: string; + updatedAt: string; +}; diff --git a/packages/types/concepts.d.ts b/packages/types/concepts.d.ts new file mode 100644 index 00000000..9f58535c --- /dev/null +++ b/packages/types/concepts.d.ts @@ -0,0 +1 @@ +export type Concept = 'A' | 'B' | 'C' | 'D' | 'F' | 'O' | 'I' | 'E'; diff --git a/packages/types/index.ts b/packages/types/index.ts new file mode 100644 index 00000000..6abba48f --- /dev/null +++ b/packages/types/index.ts @@ -0,0 +1,7 @@ +export type * from './concepts'; +export type * from './request-error'; +export type * from './search'; +export type * from './subjects'; +export type * from './teachers'; +export type * from './users'; +export type * from './comments'; \ No newline at end of file diff --git a/packages/types/package.json b/packages/types/package.json new file mode 100644 index 00000000..27ec6a88 --- /dev/null +++ b/packages/types/package.json @@ -0,0 +1,10 @@ +{ + "name": "types", + "version": "0.0.0", + "main": "index.ts", + "types": "index.ts", + "license": "MIT", + "publishConfig": { + "access": "public" + } +} diff --git a/packages/types/request-error.d.ts b/packages/types/request-error.d.ts new file mode 100644 index 00000000..11ce32e9 --- /dev/null +++ b/packages/types/request-error.d.ts @@ -0,0 +1,6 @@ +export type RequestError = { + status: number; + name: string; + type: string; + error: string; +}; diff --git a/packages/types/search.d.ts b/packages/types/search.d.ts new file mode 100644 index 00000000..d0025bbb --- /dev/null +++ b/packages/types/search.d.ts @@ -0,0 +1,18 @@ +export type SearchTeacher = { + _id: string; + name: string; + updatedAt: string; + createdAt: string; + __v: number; + alias?: string[]; +}[]; + +export type SearchSubject = { + _id: string; + name: string; + search: string; + updatedAt: string; + createdAt: string; + __v: number; + creditos: number; +}[]; diff --git a/packages/types/subjects.d.ts b/packages/types/subjects.d.ts new file mode 100644 index 00000000..1dd2ec57 --- /dev/null +++ b/packages/types/subjects.d.ts @@ -0,0 +1,42 @@ +import { ConceptData } from './teachers'; + +export type SubjectSpecific = { + _id: { mainTeacher: string | null }; + distribution: ConceptData[]; + numericWeight: number; + numeric: number; + amount: number; + count: number; + cr_professor: number; + teacher: { + alias: []; + _id: string; + name: string; + updatedAt: string; + createdAt: string; + __v: number; + }; + cr_medio: number; +}; + +export type SubjectInfo = { + subject: { + _id: string; + name: string; + search: string; + updatedAt: string; + createdAt: string; + __v: number; + creditos: number; + }; + general: { + cr_medio: number; + cr_professor: number; + count: number; + amount: number; + numeric: number; + numericWeight: number; + distribution: ConceptData[]; + }; + specific: SubjectSpecific[]; +}; diff --git a/packages/types/teachers.d.ts b/packages/types/teachers.d.ts new file mode 100644 index 00000000..d0eb83b2 --- /dev/null +++ b/packages/types/teachers.d.ts @@ -0,0 +1,50 @@ +import { Concept } from './concepts'; + +export type ConceptData = { + conceito: Concept; + cr_medio: number; + cr_professor: number; + count: number; + amount: number; + numeric: number; + numericWeight: number; +}; + +export type TeacherReviewSubject = { + _id: { + _id: string; + name: string; + search: string; + updatedAt: string; + createdAt: string; + __v: number; + creditos: number; + }; + distribution: ConceptData[]; + numericWeight: number; + numeric: number; + amount: number; + count: number; + cr_professor: number; + cr_medio: number; +}; + +export type TeacherReview = { + teacher: { + _id: string; + name: string; + updatedAt: string; + createdAt: string; + __v: number; + }; + general: { + cr_medio: number; + cr_professor: number; + count: number; + amount: number; + numeric: number; + numericWeight: number; + distribution: ConceptData[]; + }; + specific: TeacherReviewSubject[]; +}; diff --git a/packages/types/users.d.ts b/packages/types/users.d.ts new file mode 100644 index 00000000..cdae8913 --- /dev/null +++ b/packages/types/users.d.ts @@ -0,0 +1,23 @@ +type OAuth = { + email: string; + facebook: string; + picture: string; + emailFacebook: string; +}; + +type Device = { + _id: string; + deviceId: string; + token: string; + phone: string; +}; + +export type User = { + _id: string; + oauth: OAuth; + confirmed: boolean; + email: string; + ra: number; + createdAt: string; + devices: Device[]; +}; diff --git a/packages/utils/index.ts b/packages/utils/index.ts new file mode 100644 index 00000000..0b1267d0 --- /dev/null +++ b/packages/utils/index.ts @@ -0,0 +1,3 @@ +export { default as transformConceptDataToObject } from './transformConceptDataToObject'; +export { default as transformDataToTimeAgo } from './transformDataToTimeAgo'; +export * from './seasonFormatting'; \ No newline at end of file diff --git a/packages/utils/package.json b/packages/utils/package.json new file mode 100644 index 00000000..6ee3d777 --- /dev/null +++ b/packages/utils/package.json @@ -0,0 +1,13 @@ +{ + "name": "utils", + "version": "0.0.0", + "main": "index.ts", + "types": "index.ts", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "dependencies": { + "types": "*" + } +} diff --git a/packages/utils/seasonFormatting.ts b/packages/utils/seasonFormatting.ts new file mode 100644 index 00000000..d9257ad7 --- /dev/null +++ b/packages/utils/seasonFormatting.ts @@ -0,0 +1,17 @@ +export const checkEAD = (year: string | number, quad: string | number) => { + const possibles = [ + '2020:1', + '2020:2', + '2020:3', + '2021:1', + '2021:2', + '2021:3', + '2022:1', + '2022:2', + ]; + return possibles.includes( + `${year}:${quad}`, + ); +} + +export const formatSeason = (year: string | number, quad: string | number) => `Q${year} ${quad}` diff --git a/packages/utils/transformConceptDataToObject.ts b/packages/utils/transformConceptDataToObject.ts new file mode 100644 index 00000000..4de50e6e --- /dev/null +++ b/packages/utils/transformConceptDataToObject.ts @@ -0,0 +1,17 @@ +import { ConceptData } from 'types'; + +const transformConceptDataToObject = (grades: ConceptData[], count: number) => { + const result: { [x: string]: number } = {}; + grades.forEach((grade) => { + result[grade.conceito] = grade.count; + }); + const ordered = Object.keys(result) + .sort() + .reduce((obj: typeof result, key) => { + obj[key] = result[key]; + return obj; + }, {}); + return ordered; +}; + +export default transformConceptDataToObject; diff --git a/packages/utils/transformDataToTimeAgo.ts b/packages/utils/transformDataToTimeAgo.ts new file mode 100644 index 00000000..a050cc5e --- /dev/null +++ b/packages/utils/transformDataToTimeAgo.ts @@ -0,0 +1,10 @@ +import dayjs from 'dayjs'; +import ptBr from 'dayjs/locale/pt-br'; +import relativeTime from 'dayjs/plugin/relativeTime'; + +dayjs.extend(relativeTime); +dayjs.locale(ptBr); + +const transformDataToTimeAgo = (date: string) => dayjs(date).fromNow(true); + +export default transformDataToTimeAgo; From 28582a0f1669d8c96160674713e050093e7e66ce Mon Sep 17 00:00:00 2001 From: FusiDaniel Date: Thu, 26 Oct 2023 20:48:19 -0300 Subject: [PATCH 03/13] chore: project configs --- apps/container/package.json | 13 +- apps/container/src/App.vue | 25 +- .../src/assets/comment_not_found.gif | Bin 0 -> 573781 bytes apps/container/src/bootstrap.ts | 30 +- yarn.lock | 1238 ++++++++++++++++- 5 files changed, 1267 insertions(+), 39 deletions(-) create mode 100644 apps/container/src/assets/comment_not_found.gif diff --git a/apps/container/package.json b/apps/container/package.json index b1b512cd..b85dd0b2 100644 --- a/apps/container/package.json +++ b/apps/container/package.json @@ -12,6 +12,7 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "@amcharts/amcharts5": "^5.4.1", "@mdi/font": "^7.2.96", "@tanstack/query-core": "^5.0.0-rc.4", "@tanstack/vue-query": "5.0.0-rc.4", @@ -25,10 +26,16 @@ "react-dom": "^18.2.0", "services": "*", "stores": "*", + "consts": "*", + "utils": "*", "vue": "3.3.4", + "dayjs": "^1.11.9", + "lodash.debounce": "^4.0.8", "vue-router": "4.2.5", "vue-zustand": "^0.6.0", - "vuetify": "3.3.20" + "vuetify": "3.3.20", + "highcharts": "^11.1.0", + "highcharts-vue": "^1.4.3" }, "devDependencies": { "@babel/plugin-transform-private-methods": "^7.22.5", @@ -36,6 +43,7 @@ "@testing-library/jest-dom": "^6.1.3", "@testing-library/user-event": "^14.5.1", "@testing-library/vue": "^7.0.0", + "@types/lodash.debounce": "^4.0.7", "@typescript-eslint/eslint-plugin": "6.7.4", "@typescript-eslint/parser": "6.7.4", "@vitejs/plugin-vue": "^4.4.0", @@ -58,7 +66,8 @@ "sass": "1.68.0", "sass-loader": "13.3.2", "typescript": "5.2.2", - "vitest": "^0.34.6" + "vitest": "^0.34.6", + "types": "*" }, "gitHooks": { "pre-commit": "lint-staged" diff --git a/apps/container/src/App.vue b/apps/container/src/App.vue index 06c7d86a..707a7031 100644 --- a/apps/container/src/App.vue +++ b/apps/container/src/App.vue @@ -2,7 +2,7 @@ - + @@ -10,12 +10,14 @@ diff --git a/apps/container/src/components/ConceptsHorizontalChart.vue b/apps/container/src/components/ConceptsHorizontalChart.vue new file mode 100644 index 00000000..13ed1f6f --- /dev/null +++ b/apps/container/src/components/ConceptsHorizontalChart.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/apps/container/src/components/ConceptsPieChart.vue b/apps/container/src/components/ConceptsPieChart.vue new file mode 100644 index 00000000..eab8af79 --- /dev/null +++ b/apps/container/src/components/ConceptsPieChart.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/apps/container/src/components/PaperCard/PaperCard.vue b/apps/container/src/components/PaperCard/PaperCard.vue index eed27dbf..98f66daf 100644 --- a/apps/container/src/components/PaperCard/PaperCard.vue +++ b/apps/container/src/components/PaperCard/PaperCard.vue @@ -1,5 +1,5 @@ diff --git a/apps/container/src/views/Relationship/RelationshipView.vue b/apps/container/src/views/Relationship/RelationshipView.vue deleted file mode 100644 index d1334af6..00000000 --- a/apps/container/src/views/Relationship/RelationshipView.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/apps/container/src/views/Relationship/index.ts b/apps/container/src/views/Relationship/index.ts deleted file mode 100644 index d4c321c8..00000000 --- a/apps/container/src/views/Relationship/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as RelationshipView } from './RelationshipView.vue'; diff --git a/apps/container/src/views/Reviews/ReviewsView.vue b/apps/container/src/views/Reviews/ReviewsView.vue index c5d5a88c..3bdd56c2 100644 --- a/apps/container/src/views/Reviews/ReviewsView.vue +++ b/apps/container/src/views/Reviews/ReviewsView.vue @@ -1,16 +1,28 @@ From 42461eed40721080120463a13104bc8ac12ed020 Mon Sep 17 00:00:00 2001 From: FusiDaniel Date: Thu, 26 Oct 2023 21:37:39 -0300 Subject: [PATCH 08/13] refactor: better falsy comparison --- apps/container/src/components/CommentsList.vue | 4 ++-- apps/container/src/components/TeacherReview.vue | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/container/src/components/CommentsList.vue b/apps/container/src/components/CommentsList.vue index 9e2354e5..b124158c 100644 --- a/apps/container/src/components/CommentsList.vue +++ b/apps/container/src/components/CommentsList.vue @@ -95,7 +95,7 @@ const { const selectedSubjectId = computed( () => teacherData.value?.data.specific - .filter((subject) => subject._id !== null) + .filter((subject) => subject._id) .find((subject) => subject._id.name === selectedSubject.value)?._id._id || '', ); @@ -142,7 +142,7 @@ const subjects = computed(() => { return [ 'Todas as matérias', ...teacherData.value.data.specific - .filter((subject) => subject._id !== null) + .filter((subject) => subject._id) .map((subject) => subject._id.name) .sort(), ]; diff --git a/apps/container/src/components/TeacherReview.vue b/apps/container/src/components/TeacherReview.vue index 49822b97..4517bfc6 100644 --- a/apps/container/src/components/TeacherReview.vue +++ b/apps/container/src/components/TeacherReview.vue @@ -105,11 +105,11 @@ const chips = computed(() => { return [ { value: teacherData.value.data.specific.filter( - (subject) => subject._id !== null, + (subject) => subject._id, ).length, text: teacherData.value.data.specific.filter( - (subject) => subject._id !== null, + (subject) => subject._id, ).length == 1 ? 'disciplina' : 'disciplinas', @@ -120,7 +120,7 @@ const chips = computed(() => { selectedSubject.value === 'Todas as matérias' ? teacherData.value.data.general.count : teacherData.value.data.specific - .filter((subject) => subject._id !== null) + .filter((subject) => subject._id) .find((subject) => subject._id.name === selectedSubject.value) ?.count, text: @@ -129,7 +129,7 @@ const chips = computed(() => { ? 'conceito' : 'conceitos' : teacherData.value.data.specific - .filter((subject) => subject._id !== null) + .filter((subject) => subject._id) .find((subject) => subject._id.name === selectedSubject.value) ?.count == 1 ? 'conceito' @@ -148,7 +148,7 @@ const grades = computed(() => { ); } const data = teacherData.value.data.specific - .filter((subject) => subject._id !== null) + .filter((subject) => subject._id) .find((subject) => subject._id.name === selectedSubject.value); return transformConceptDataToObject( data?.distribution || [], From ad787b34e7072938b2fe77dcce43c9b9cfa811c8 Mon Sep 17 00:00:00 2001 From: FusiDaniel Date: Fri, 27 Oct 2023 00:06:56 -0300 Subject: [PATCH 09/13] refactor: typos, renaming and code structure --- apps/container/package.json | 1 - .../container/src/components/CommentsList.vue | 7 +-- .../components/ConceptsHorizontalChart.vue | 15 ++--- .../src/components/ConceptsPieChart.vue | 15 ++--- ...llment.vue => PendingReviewEnrollment.vue} | 5 +- ...t.vue => PendingReviewEnrollmentsList.vue} | 7 ++- .../container/src/components/ReviewDialog.vue | 37 ++++++----- apps/container/src/components/SearchBar.vue | 58 ++++++++---------- .../src/components/SingleComment.vue | 26 ++++---- .../src/components/SubjectReview.vue | 4 +- .../src/components/TeacherReview.vue | 40 ++++-------- .../src/views/History/HistoryView.vue | 61 +++++++++---------- .../src/views/Reviews/ReviewsView.vue | 8 +-- packages/consts/index.ts | 12 ---- packages/consts/package.json | 10 --- packages/services/comments.ts | 30 +++++---- packages/services/enrollments.ts | 4 +- packages/services/index.ts | 4 -- packages/services/reviews.ts | 34 +++-------- packages/services/users.ts | 4 +- packages/types/{comments.d.ts => comments.ts} | 0 packages/types/{concepts.d.ts => concepts.ts} | 0 .../{request-error.d.ts => request-error.ts} | 0 packages/types/{search.d.ts => search.ts} | 4 +- packages/types/{subjects.d.ts => subjects.ts} | 0 packages/types/{teachers.d.ts => teachers.ts} | 0 packages/types/{users.d.ts => users.ts} | 0 packages/utils/consts.ts | 16 +++++ ...sformDataToTimeAgo.ts => dateToTimeAgo.ts} | 4 +- packages/utils/index.ts | 5 +- packages/utils/seasonFormatting.ts | 2 +- 31 files changed, 178 insertions(+), 235 deletions(-) rename apps/container/src/components/{ToReviewEnrollment.vue => PendingReviewEnrollment.vue} (95%) rename apps/container/src/components/{ToReviewEnrollmentList.vue => PendingReviewEnrollmentsList.vue} (90%) delete mode 100644 packages/consts/index.ts delete mode 100644 packages/consts/package.json rename packages/types/{comments.d.ts => comments.ts} (100%) rename packages/types/{concepts.d.ts => concepts.ts} (100%) rename packages/types/{request-error.d.ts => request-error.ts} (100%) rename packages/types/{search.d.ts => search.ts} (78%) rename packages/types/{subjects.d.ts => subjects.ts} (100%) rename packages/types/{teachers.d.ts => teachers.ts} (100%) rename packages/types/{users.d.ts => users.ts} (100%) create mode 100644 packages/utils/consts.ts rename packages/utils/{transformDataToTimeAgo.ts => dateToTimeAgo.ts} (59%) diff --git a/apps/container/package.json b/apps/container/package.json index b85dd0b2..377a4528 100644 --- a/apps/container/package.json +++ b/apps/container/package.json @@ -26,7 +26,6 @@ "react-dom": "^18.2.0", "services": "*", "stores": "*", - "consts": "*", "utils": "*", "vue": "3.3.4", "dayjs": "^1.11.9", diff --git a/apps/container/src/components/CommentsList.vue b/apps/container/src/components/CommentsList.vue index b124158c..fcfdce22 100644 --- a/apps/container/src/components/CommentsList.vue +++ b/apps/container/src/components/CommentsList.vue @@ -113,11 +113,8 @@ const { Comments.get(teacherId.value, selectedSubjectId.value, pageParam), refetchOnWindowFocus: false, enabled: !!teacherId.value, - getNextPageParam: (lastPage, allPages) => { - if ( - (lastPage as { data: { total: number } }).data.total >= - allPages.length * 10 - ) { + getNextPageParam: (lastPage: { data: { total: number } }, allPages) => { + if (lastPage.data.total >= allPages.length * 10) { return allPages.length; } }, diff --git a/apps/container/src/components/ConceptsHorizontalChart.vue b/apps/container/src/components/ConceptsHorizontalChart.vue index 13ed1f6f..f0f7a1dd 100644 --- a/apps/container/src/components/ConceptsHorizontalChart.vue +++ b/apps/container/src/components/ConceptsHorizontalChart.vue @@ -12,10 +12,10 @@ > @@ -23,7 +23,7 @@ Dados sem muitas amostras @@ -31,21 +31,18 @@ diff --git a/apps/container/src/components/SingleComment.vue b/apps/container/src/components/SingleComment.vue index a6885490..f732aaa8 100644 --- a/apps/container/src/components/SingleComment.vue +++ b/apps/container/src/components/SingleComment.vue @@ -13,7 +13,7 @@ {{ comment?.enrollment.conceito }}

- {{ `Q${season.split(':')[1]} ${season.split(':')[0]}` }} + {{ season }}

@@ -67,7 +67,7 @@ :color="like ? 'primary' : ''" > - {{ `${likeCount || 0}` }} + {{ likeCount }} - {{ `${recommendationCount || 0}` }} + {{ recommendationCount }} Há {{ date }} @@ -94,11 +94,10 @@ diff --git a/packages/consts/index.ts b/packages/consts/index.ts deleted file mode 100644 index 926478fd..00000000 --- a/packages/consts/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const conceptsColor = { - A: '#3FCF8C', - B: '#B8E986', - C: '#F8B74C', - D: '#FFA004', - F: '#F95469', - O: '#A9A9A9', - I: '#1976D2', - E: '#1976D2', - null: '#000000', -}; - diff --git a/packages/consts/package.json b/packages/consts/package.json deleted file mode 100644 index 52a779dc..00000000 --- a/packages/consts/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "consts", - "version": "0.0.0", - "main": "index.ts", - "types": "index.ts", - "license": "MIT", - "publishConfig": { - "access": "public" - } -} diff --git a/packages/services/comments.ts b/packages/services/comments.ts index 420d5a16..3e228bb5 100644 --- a/packages/services/comments.ts +++ b/packages/services/comments.ts @@ -2,12 +2,12 @@ import { Comment } from 'types'; import api from './api'; -export type GetCommentResponse = { +type GetCommentResponse = { data: Comment[]; total: number; }; -export type CreateCommentRequest = { +type CreateCommentRequest = { comment: string, enrollment: string, type: string @@ -23,30 +23,28 @@ type CommentResponse = { updatedAt: string; } -export type CreateCommentResponse = CommentResponse +type CreateCommentResponse = CommentResponse -export type UpdateCommentRequest = { +type UpdateCommentRequest = { id: string; comment: string; }; -export type UpdateCommentResponse = CommentResponse +type UpdateCommentResponse = CommentResponse -const comment = { - get: async (teacherId: string, subjectId: string, pageParam = 0) => +export const Comments = { + get: (teacherId: string, subjectId: string, pageParam = 0) => api.get(`/comments/${teacherId}/${subjectId}`, { params: { page: pageParam, limit: 10 }, }), - getUserComment: async (enrollmentId: string) => api.get(`/comments/enrollment/${enrollmentId}`), - create: async (data: CreateCommentRequest) => api.post('/comments/', data), - update: async ({ id, comment }: UpdateCommentRequest) => + getUserComment: (enrollmentId: string) => api.get(`/comments/enrollment/${enrollmentId}`), + create: (data: CreateCommentRequest) => api.post('/comments/', data), + update: ({ id, comment }: UpdateCommentRequest) => api.put('/comments/' + id, { comment }), - like: async (id: string) => api.post(`/reactions/${id}`, { kind: 'like' }), - recommendation: async (id: string) => + like: (id: string) => api.post(`/reactions/${id}`, { kind: 'like' }), + recommendation: (id: string) => api.post(`/reactions/${id}`, { kind: 'recommendation' }), - removeLike: async (id: string) => api.delete(`/reactions/${id}/like`), - removeRecommendation: async (id: string) => + removeLike: (id: string) => api.delete(`/reactions/${id}/like`), + removeRecommendation: (id: string) => api.delete(`/reactions/${id}/recommendation`), }; - -export default comment; diff --git a/packages/services/enrollments.ts b/packages/services/enrollments.ts index 85e8bd43..ee5e766a 100644 --- a/packages/services/enrollments.ts +++ b/packages/services/enrollments.ts @@ -50,9 +50,9 @@ export type Enrollment = { comments?: string[] }; -const enrollment = { +export const Enrollments = { list: () => api.get('/enrollments'), get: (id: string) => api.get('/enrollments/' + id), }; -export default enrollment; + diff --git a/packages/services/index.ts b/packages/services/index.ts index 308176e8..727c6ffa 100644 --- a/packages/services/index.ts +++ b/packages/services/index.ts @@ -1,7 +1,3 @@ -export { default as Comments } from './comments'; -export { default as Enrollments } from './enrollments'; -export { default as Users } from './users'; -export { default as Reviews } from './reviews'; export * from './comments'; export * from './enrollments'; export * from './users'; diff --git a/packages/services/reviews.ts b/packages/services/reviews.ts index c0eadfc1..057de685 100644 --- a/packages/services/reviews.ts +++ b/packages/services/reviews.ts @@ -1,37 +1,23 @@ -import { SubjectInfo, TeacherReview } from 'types'; +import { + SubjectInfo, + TeacherReview, + SearchTeacherItem, + SearchSubjectItem, +} from 'types'; import api from './api'; -export type SearchTeacherItem = { - _id: string; - name: string; - updatedAt?: string; - createdAt?: string; - __v?: number; - alias?: string[]; -}; - -export type SearchTeacher = { +type SearchTeacher = { data: SearchTeacherItem[]; total: number; }; -export type SearchSubjectItem = { - _id: string; - name: string; - search: string; - updatedAt: string; - createdAt: string; - __v: number; - creditos: number; -}; - -export type SearchSubject = { +type SearchSubject = { data: SearchSubjectItem[]; total: number; }; -const reviews = { +export const Reviews = { searchTeachers: async (q: string) => api.get('/teachers/search', { params: { q }, @@ -45,5 +31,3 @@ const reviews = { getSubject: async (id: string) => api.get(`/reviews/subjects/${id}`), }; - -export default reviews; diff --git a/packages/services/users.ts b/packages/services/users.ts index d603d7c7..b37e9a7a 100644 --- a/packages/services/users.ts +++ b/packages/services/users.ts @@ -25,7 +25,7 @@ export type User = { devices: Device[]; }; -const user = { +export const Users = { completeSignup: (params = {}) => api.put('/users/complete', params), confirmSignup: (params = {}) => api.post('/account/confirm', params), resendEmail: () => api.post('/users/me/resend'), @@ -33,5 +33,3 @@ const user = { delete: () => api.delete('/users/me/delete'), info: () => api.get('/users/info'), }; - -export default user; diff --git a/packages/types/comments.d.ts b/packages/types/comments.ts similarity index 100% rename from packages/types/comments.d.ts rename to packages/types/comments.ts diff --git a/packages/types/concepts.d.ts b/packages/types/concepts.ts similarity index 100% rename from packages/types/concepts.d.ts rename to packages/types/concepts.ts diff --git a/packages/types/request-error.d.ts b/packages/types/request-error.ts similarity index 100% rename from packages/types/request-error.d.ts rename to packages/types/request-error.ts diff --git a/packages/types/search.d.ts b/packages/types/search.ts similarity index 78% rename from packages/types/search.d.ts rename to packages/types/search.ts index d0025bbb..734b8ff7 100644 --- a/packages/types/search.d.ts +++ b/packages/types/search.ts @@ -1,4 +1,4 @@ -export type SearchTeacher = { +export type SearchTeacherItem = { _id: string; name: string; updatedAt: string; @@ -7,7 +7,7 @@ export type SearchTeacher = { alias?: string[]; }[]; -export type SearchSubject = { +export type SearchSubjectItem = { _id: string; name: string; search: string; diff --git a/packages/types/subjects.d.ts b/packages/types/subjects.ts similarity index 100% rename from packages/types/subjects.d.ts rename to packages/types/subjects.ts diff --git a/packages/types/teachers.d.ts b/packages/types/teachers.ts similarity index 100% rename from packages/types/teachers.d.ts rename to packages/types/teachers.ts diff --git a/packages/types/users.d.ts b/packages/types/users.ts similarity index 100% rename from packages/types/users.d.ts rename to packages/types/users.ts diff --git a/packages/utils/consts.ts b/packages/utils/consts.ts new file mode 100644 index 00000000..ee6ca96a --- /dev/null +++ b/packages/utils/consts.ts @@ -0,0 +1,16 @@ +export const conceptsColor = { + A: '#3FCF8C', + B: '#B8E986', + C: '#F8B74C', + D: '#FFA004', + F: '#F95469', + O: '#A9A9A9', + I: '#1976D2', + E: '#1976D2', + null: '#000000', +}; + +export const extensionURL = + 'https://chrome.google.com/webstore/detail/ufabc-matricula/gphjopenfpnlnffmhhhhdiecgdcopmhk'; + +export const studentRecordURL = 'https://aluno.ufabc.edu.br/fichas_individuais'; diff --git a/packages/utils/transformDataToTimeAgo.ts b/packages/utils/dateToTimeAgo.ts similarity index 59% rename from packages/utils/transformDataToTimeAgo.ts rename to packages/utils/dateToTimeAgo.ts index a050cc5e..03c460d3 100644 --- a/packages/utils/transformDataToTimeAgo.ts +++ b/packages/utils/dateToTimeAgo.ts @@ -5,6 +5,6 @@ import relativeTime from 'dayjs/plugin/relativeTime'; dayjs.extend(relativeTime); dayjs.locale(ptBr); -const transformDataToTimeAgo = (date: string) => dayjs(date).fromNow(true); +const dateToTimeAgo = (date: string) => dayjs(date).fromNow(true); -export default transformDataToTimeAgo; +export default dateToTimeAgo; diff --git a/packages/utils/index.ts b/packages/utils/index.ts index 0b1267d0..5a3c00c7 100644 --- a/packages/utils/index.ts +++ b/packages/utils/index.ts @@ -1,3 +1,4 @@ export { default as transformConceptDataToObject } from './transformConceptDataToObject'; -export { default as transformDataToTimeAgo } from './transformDataToTimeAgo'; -export * from './seasonFormatting'; \ No newline at end of file +export { default as dateToTimeAgo } from './dateToTimeAgo'; +export * from './seasonFormatting'; +export * from './consts'; diff --git a/packages/utils/seasonFormatting.ts b/packages/utils/seasonFormatting.ts index d9257ad7..a0d349a6 100644 --- a/packages/utils/seasonFormatting.ts +++ b/packages/utils/seasonFormatting.ts @@ -14,4 +14,4 @@ export const checkEAD = (year: string | number, quad: string | number) => { ); } -export const formatSeason = (year: string | number, quad: string | number) => `Q${year} ${quad}` +export const formatSeason = (quad: string | number, year: string | number) => `Q${quad} ${year}` From a45eba7e321a0692050fe63f5fc8479669903e62 Mon Sep 17 00:00:00 2001 From: FusiDaniel Date: Fri, 27 Oct 2023 00:21:45 -0300 Subject: [PATCH 10/13] fix: highcharts import type --- apps/container/src/bootstrap.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/container/src/bootstrap.ts b/apps/container/src/bootstrap.ts index befcb9f1..bf916d08 100644 --- a/apps/container/src/bootstrap.ts +++ b/apps/container/src/bootstrap.ts @@ -74,5 +74,5 @@ createApp(App) .use(VueQueryPlugin, { queryClient, }) - .use(HighchartsVue as never) + .use(HighchartsVue as any) .mount('#app'); From ae07288691348f14c8b88cf01c1e168f9e1205fe Mon Sep 17 00:00:00 2001 From: FusiDaniel Date: Fri, 27 Oct 2023 00:22:02 -0300 Subject: [PATCH 11/13] refactor: remove default imports --- packages/utils/dateToTimeAgo.ts | 4 +--- packages/utils/index.ts | 4 ++-- packages/utils/transformConceptDataToObject.ts | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/utils/dateToTimeAgo.ts b/packages/utils/dateToTimeAgo.ts index 03c460d3..78a23559 100644 --- a/packages/utils/dateToTimeAgo.ts +++ b/packages/utils/dateToTimeAgo.ts @@ -5,6 +5,4 @@ import relativeTime from 'dayjs/plugin/relativeTime'; dayjs.extend(relativeTime); dayjs.locale(ptBr); -const dateToTimeAgo = (date: string) => dayjs(date).fromNow(true); - -export default dateToTimeAgo; +export const dateToTimeAgo = (date: string) => dayjs(date).fromNow(true); diff --git a/packages/utils/index.ts b/packages/utils/index.ts index 5a3c00c7..df90f115 100644 --- a/packages/utils/index.ts +++ b/packages/utils/index.ts @@ -1,4 +1,4 @@ -export { default as transformConceptDataToObject } from './transformConceptDataToObject'; -export { default as dateToTimeAgo } from './dateToTimeAgo'; +export * from './transformConceptDataToObject'; +export * from './dateToTimeAgo'; export * from './seasonFormatting'; export * from './consts'; diff --git a/packages/utils/transformConceptDataToObject.ts b/packages/utils/transformConceptDataToObject.ts index 4de50e6e..baf523e0 100644 --- a/packages/utils/transformConceptDataToObject.ts +++ b/packages/utils/transformConceptDataToObject.ts @@ -1,6 +1,6 @@ import { ConceptData } from 'types'; -const transformConceptDataToObject = (grades: ConceptData[], count: number) => { +export const transformConceptDataToObject = (grades: ConceptData[], count: number) => { const result: { [x: string]: number } = {}; grades.forEach((grade) => { result[grade.conceito] = grade.count; @@ -12,6 +12,4 @@ const transformConceptDataToObject = (grades: ConceptData[], count: number) => { return obj; }, {}); return ordered; -}; - -export default transformConceptDataToObject; +}; \ No newline at end of file From f359abad6be9b192b70079a1a50c67dc92b76375 Mon Sep 17 00:00:00 2001 From: FusiDaniel Date: Fri, 27 Oct 2023 00:34:00 -0300 Subject: [PATCH 12/13] fix: eslint --- apps/container/package.json | 3 ++- apps/container/src/bootstrap.ts | 1 + apps/react/package.json | 3 ++- package.json | 1 + packages/services/comments.ts | 25 ++++++------------------- packages/services/enrollments.ts | 32 +++++++++++++++----------------- packages/services/package.json | 3 ++- packages/services/reviews.ts | 4 ++-- packages/stores/package.json | 3 ++- turbo.json | 1 + 10 files changed, 34 insertions(+), 42 deletions(-) diff --git a/apps/container/package.json b/apps/container/package.json index 377a4528..bff44899 100644 --- a/apps/container/package.json +++ b/apps/container/package.json @@ -9,7 +9,8 @@ "build:staging": "vue-cli-service build --mode staging", "test": "vitest run --coverage", "test:watch": "vitest --coverage", - "lint": "vue-cli-service lint" + "lint": "vue-cli-service lint", + "lint:fix": "vue-cli-service lint --fix" }, "dependencies": { "@amcharts/amcharts5": "^5.4.1", diff --git a/apps/container/src/bootstrap.ts b/apps/container/src/bootstrap.ts index bf916d08..a585d19a 100644 --- a/apps/container/src/bootstrap.ts +++ b/apps/container/src/bootstrap.ts @@ -74,5 +74,6 @@ createApp(App) .use(VueQueryPlugin, { queryClient, }) + // eslint-disable-next-line @typescript-eslint/no-explicit-any .use(HighchartsVue as any) .mount('#app'); diff --git a/apps/react/package.json b/apps/react/package.json index db7edfaa..4628fa9c 100644 --- a/apps/react/package.json +++ b/apps/react/package.json @@ -5,7 +5,8 @@ "scripts": { "dev": "webpack serve --mode development", "build": "webpack --mode production", - "lint": "eslint ." + "lint": "eslint .", + "lint:fix": "eslint . --fix" }, "devDependencies": { "@babel/core": "^7.22.9", diff --git a/package.json b/package.json index 7fb228ab..8222dfd2 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "build": "turbo run build", "dev": "turbo run dev", "lint": "turbo run lint", + "lint:fix": "turbo run lint:fix", "test": "turbo run test" }, "devDependencies": { diff --git a/packages/services/comments.ts b/packages/services/comments.ts index 3e228bb5..f7eac898 100644 --- a/packages/services/comments.ts +++ b/packages/services/comments.ts @@ -1,5 +1,5 @@ - import { Comment } from 'types'; + import api from './api'; type GetCommentResponse = { @@ -8,36 +8,23 @@ type GetCommentResponse = { }; type CreateCommentRequest = { - comment: string, - enrollment: string, - type: string -}; - -type CommentResponse = { - _id: string; comment: string; - createdAt: string; - enrollment: { _id: string; }; - subject: string; - teacher: string; - updatedAt: string; -} - -type CreateCommentResponse = CommentResponse + enrollment: string; + type: string; +}; type UpdateCommentRequest = { id: string; comment: string; }; -type UpdateCommentResponse = CommentResponse - export const Comments = { get: (teacherId: string, subjectId: string, pageParam = 0) => api.get(`/comments/${teacherId}/${subjectId}`, { params: { page: pageParam, limit: 10 }, }), - getUserComment: (enrollmentId: string) => api.get(`/comments/enrollment/${enrollmentId}`), + getUserComment: (enrollmentId: string) => + api.get(`/comments/enrollment/${enrollmentId}`), create: (data: CreateCommentRequest) => api.post('/comments/', data), update: ({ id, comment }: UpdateCommentRequest) => api.put('/comments/' + id, { comment }), diff --git a/packages/services/enrollments.ts b/packages/services/enrollments.ts index ee5e766a..6af3b144 100644 --- a/packages/services/enrollments.ts +++ b/packages/services/enrollments.ts @@ -3,19 +3,19 @@ import { Concept } from 'types'; import api from './api'; type EnrollmentTeacherComment = { - _id: string, - comment: string, - viewers: number, - enrollment: string, - type: string, - ra: string, - active: boolean, - teacher: string, - subject: string, - updatedAt: string, - createdAt: string, - __v: number -} + _id: string; + comment: string; + viewers: number; + enrollment: string; + type: string; + ra: string; + active: boolean; + teacher: string; + subject: string; + updatedAt: string; + createdAt: string; + __v: number; +}; type EnrollmentTeacher = { _id: string; @@ -23,7 +23,7 @@ type EnrollmentTeacher = { updatedAt: string; createdAt: string; __v: number; - comment?: EnrollmentTeacherComment + comment?: EnrollmentTeacherComment; }; export type Subject = { @@ -47,12 +47,10 @@ export type Enrollment = { quad: number; subject: Subject; year: number; - comments?: string[] + comments?: string[]; }; export const Enrollments = { list: () => api.get('/enrollments'), get: (id: string) => api.get('/enrollments/' + id), }; - - diff --git a/packages/services/package.json b/packages/services/package.json index 5c825ad0..aa89baac 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -4,7 +4,8 @@ "main": "./index.ts", "license": "MIT", "scripts": { - "lint": "eslint \"**/*.ts\"" + "lint": "eslint \"**/*.ts\"", + "lint:fix": "eslint \"**/*.ts\" --fix" }, "devDependencies": { "eslint-config-custom": "*", diff --git a/packages/services/reviews.ts b/packages/services/reviews.ts index 057de685..48d8834d 100644 --- a/packages/services/reviews.ts +++ b/packages/services/reviews.ts @@ -1,8 +1,8 @@ import { + SearchSubjectItem, + SearchTeacherItem, SubjectInfo, TeacherReview, - SearchTeacherItem, - SearchSubjectItem, } from 'types'; import api from './api'; diff --git a/packages/stores/package.json b/packages/stores/package.json index e35535e0..40bed3ed 100644 --- a/packages/stores/package.json +++ b/packages/stores/package.json @@ -4,7 +4,8 @@ "main": "./index.ts", "license": "MIT", "scripts": { - "lint": "eslint \"**/*.ts\"" + "lint": "eslint \"**/*.ts\"", + "lint:fix": "eslint \"**/*.ts\" --fix" }, "devDependencies": { "eslint-config-custom": "*", diff --git a/turbo.json b/turbo.json index c190f11d..7b43e920 100644 --- a/turbo.json +++ b/turbo.json @@ -14,6 +14,7 @@ "outputs": ["dist/**"] }, "lint": {}, + "lint:fix": {}, "test": {}, "test:watch": { "cache": false From 14987c3f4bc690844d188101e80adb4ce6f9b2ee Mon Sep 17 00:00:00 2001 From: FusiDaniel Date: Fri, 27 Oct 2023 01:54:46 -0300 Subject: [PATCH 13/13] fix: history review test --- apps/container/src/views/History/HistoryView.test.ts | 5 ++++- apps/container/src/views/History/HistoryView.vue | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/container/src/views/History/HistoryView.test.ts b/apps/container/src/views/History/HistoryView.test.ts index 4aea4242..aabbe4ce 100644 --- a/apps/container/src/views/History/HistoryView.test.ts +++ b/apps/container/src/views/History/HistoryView.test.ts @@ -44,7 +44,10 @@ describe('', () => { server.use( rest.get(`*/users/info`, (_req, res, ctx) => res(ctx.status(500))), ); - render(HistoryView); + render(HistoryView, { + // disable retry + + }); expect( await screen.findByText(enrollments[0].disciplina), ).toBeInTheDocument(); diff --git a/apps/container/src/views/History/HistoryView.vue b/apps/container/src/views/History/HistoryView.vue index f5462a47..a7db00a3 100644 --- a/apps/container/src/views/History/HistoryView.vue +++ b/apps/container/src/views/History/HistoryView.vue @@ -44,6 +44,7 @@ flat variant="text" size="x-small" + aria-labelledby="extension-dialog" > @@ -75,7 +76,11 @@ - Atualizar o histórico @@ -346,12 +351,14 @@ const { queryKey: ['enrollments', 'list'], queryFn: Enrollments.list, select: (response) => response.data, + retry: false, }); const { data: user, isError: isErrorUser } = useQuery({ queryKey: ['users', 'info'], queryFn: Users.info, select: (response) => response.data, + retry: false, }); const enrollmentByDate = computed(() => {