Skip to content

Commit

Permalink
feat: teacher review endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Joabesv committed Dec 5, 2024
1 parent fc7fd8a commit a921c23
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/components/Teachers.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<template>
<div v-if="teoria" class="mt-1.5 text-xs font-bold uppercase">
<div v-if="teoria" class="mt-1.5 text-xs font-bold uppercase cursor-pointer">
Teoria:
<a
:data="teoriaId"
:teacherName="teoria"
class="ReviewTeacher cursor-pointer text-amber-500 hover:text-amber-600 ReviewTeacher Help"
class="ReviewTeacher text-amber-500 hover:text-amber-600 ReviewTeacher Help"
>
{{ teoria }}
</a>
</div>
<div v-if="pratica" class="mt-1.5 text-xs font-bold uppercase">
<div v-if="pratica" class="mt-1.5 text-xs font-bold uppercase cursor-pointer">
Prática:
<a
:data="praticaId"
:teacherName="pratica"
class="ReviewTeacher cursor-pointer text-amber-500 hover:text-amber-600 ReviewTeacher Help"
class="ReviewTeacher text-amber-500 hover:text-amber-600 ReviewTeacher Help"
>
{{ pratica }}
</a>
Expand Down
45 changes: 42 additions & 3 deletions src/services/next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type Distribution = {
cr_professor: number;
}

type DetailedReviews = {
type SubjectDetailedReview = {
_id: {
mainTeacher: string;
}
Expand All @@ -54,6 +54,25 @@ type DetailedReviews = {
}
}

type TeacherDetailedReview = {
_id: {
_id: string;
name: string;
search: string;
updatedAt: string;
createdAt: string
__v: number;
creditos: number;
}
distribution: Array<Distribution>
numericWeight: number;
numeric: number;
amount: number;
count: number;
cr_professor: number;
cr_medio: number;
}

export type SubjectReview = {
subject: {
_id: string,
Expand All @@ -72,7 +91,27 @@ export type SubjectReview = {
numericWeight: number;
weight: number;
}
specific: Array<DetailedReviews>
specific: Array<SubjectDetailedReview>
}

export type TeacherReview = {
teacher: {
_id: string;
name: string;
alias?: string[]
updatedAt?: string
}
general: {
cr_medio: string | null
cr_professor: string | null
count: number;
amount: number;
numeric: number
numericWeight: number;
weight: number;
distribution: Array<Distribution>
}
specific: Array<TeacherDetailedReview>
}

export type Component = {
Expand Down Expand Up @@ -131,7 +170,7 @@ export async function getSubjectReviews(subjectId: string) {
}

export async function getTeacherReviews(teacherId: string) {
const reviews = await nextService<SubjectReview>(`/entities/teachers/reviews/${teacherId}`)
const reviews = await nextService<TeacherReview>(`/entities/teachers/reviews/${teacherId}`)
return reviews;
}

Expand Down

0 comments on commit a921c23

Please sign in to comment.