Skip to content

Commit

Permalink
change: fix api response typing
Browse files Browse the repository at this point in the history
  • Loading branch information
NiiMiyo committed Dec 8, 2023
1 parent e53918f commit abcc9d2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export function CurriculumAbility(props: ProfileCompetencesProps) {
return null;

Check warning on line 17 in src/pages/Profile/ProfileCurriculum/Competences/Ability/CurriculumAbility.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/Profile/ProfileCurriculum/Competences/Ability/CurriculumAbility.tsx#L17

Added line #L17 was not covered by tests
}

const sortedCompetences = (profileContext.profileListData.competences as any)
.toSorted((c1 :any, c2 :any) => new Date(c1.creationDate).getTime() - new Date(c2.creationDate).getTime());
const sortedCompetences = [...profileContext.profileListData.competences]
.sort((c1, c2) => new Date(c1.creationDate).getTime() - new Date(c2.creationDate).getTime());

Check warning on line 21 in src/pages/Profile/ProfileCurriculum/Competences/Ability/CurriculumAbility.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/Profile/ProfileCurriculum/Competences/Ability/CurriculumAbility.tsx#L20-L21

Added lines #L20 - L21 were not covered by tests

const [selectedCompeteceId, setSelectedCompeteceId] = useState('');
const [isEditing, setIsEditing] = useState(false);
Expand Down Expand Up @@ -94,15 +94,15 @@ export function CurriculumAbility(props: ProfileCompetencesProps) {
</div>
<div className="competence-list">
{profileContext.profileListData.competences.length > 0
? sortedCompetences.map((competence : any) => {
? sortedCompetences.map((competence) => {
return (

Check warning on line 98 in src/pages/Profile/ProfileCurriculum/Competences/Ability/CurriculumAbility.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/Profile/ProfileCurriculum/Competences/Ability/CurriculumAbility.tsx#L97-L98

Added lines #L97 - L98 were not covered by tests
<div className="competence-item" key={competence.id}>

<div className="competece-initial">
<h4 className="competence-type">{competence.competenceType.name}</h4>
</div>
<div className="level-container">
<h2 className="level-label">{(LevelToLabel as any)[competence.level]}</h2>
<h2 className="level-label">{(LevelToLabel)[competence.level]}</h2>
<div className="level-bar">
<div className="bar" style={{ width: `${calculateWidth(competence.level)}%` }}></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Profile/ProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function ProfilePage() {
},

reloadPage: () => {navigate(location.href)},
} as any), [loaderData]);
}), [loaderData]);

useEffect(() => {
if (auth.user === null) {
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Profile/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ export async function ProfilePageLoader(args: LoaderFunctionArgs): Promise<Profi
return {
profile: fetchProfile.body.profile,
accessingLoggedUser: fetchProfile.body.profile.user.ownerOfSession,
allTypeCompetence: (fetchCompetenceTypes as any).body?.list ?? [],
allTypeEducation: (fetchEducationTypes as any).body?.listar ?? [],
allTypeExperience: (fetchExperienceTypes as any).body?.listar ?? [],
allInstitution: (fetchInstitutions as any).body?.listar ?? [],
allTypeCompetence: fetchCompetenceTypes.body?.list ?? [],
allTypeEducation: fetchEducationTypes.body?.lista ?? [],
allTypeExperience: fetchExperienceTypes.body?.lista ?? [],
allInstitution: fetchInstitutions.body?.lista ?? [],


profileListData: {
Expand Down
2 changes: 1 addition & 1 deletion src/services/UniversimeApi/CompetenceType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type CompetenceTypeGet_RequestDTO = {
};

export type CompetenceTypeGet_ResponseDTO = ApiResponse<{ competenceType: CompetenceType }>;
export type CompetenceTypeList_ResponseDTO = CompetenceType[];
export type CompetenceTypeList_ResponseDTO = ApiResponse<{ list: CompetenceType[] }>;

export async function get(body: CompetenceTypeGet_RequestDTO) {
return (await api.post<CompetenceTypeGet_ResponseDTO>("/competencetype/get", {
Expand Down
2 changes: 1 addition & 1 deletion src/services/UniversimeApi/Institution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type institutionGet_RequestDTO = {
}

export type InstitutionTypeGet_ResponseDTO = ApiResponse<{ institution: Institution }>;
export type InstitutionTypeList_ResponseDTO = Institution[];
export type InstitutionTypeList_ResponseDTO = ApiResponse<{ lista: Institution[] }>;

export async function get(body:institutionGet_RequestDTO) {
return (await api.post<InstitutionTypeGet_ResponseDTO>("/curriculum/institution/obter", {

Check warning on line 13 in src/services/UniversimeApi/Institution.ts

View check run for this annotation

Codecov / codecov/patch

src/services/UniversimeApi/Institution.ts#L12-L13

Added lines #L12 - L13 were not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion src/services/UniversimeApi/TypeEducation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type typeEducation_RequestDTO = {
}

export type TypeEducationGet_ResponseDTO = ApiResponse<{ typeEducation: TypeEducation }>;
export type TypeEducationList_ResponseDTO = TypeEducation[];
export type TypeEducationList_ResponseDTO = ApiResponse<{lista: TypeEducation[]}>;

export async function get(body: typeEducation_RequestDTO) {
return (await api.post<TypeEducationGet_ResponseDTO>("/curriculum/TypeEducation/obter", {

Check warning on line 14 in src/services/UniversimeApi/TypeEducation.ts

View check run for this annotation

Codecov / codecov/patch

src/services/UniversimeApi/TypeEducation.ts#L13-L14

Added lines #L13 - L14 were not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion src/services/UniversimeApi/TypeExperience.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type typeExperience_RequestDTO = {
}

export type TypeExperienceGet_ResponseDTO = ApiResponse<{ typeEducation: TypeExperience }>;
export type TypeExperienceList_ResponseDTO = TypeExperience[];
export type TypeExperienceList_ResponseDTO = ApiResponse<{ lista: TypeExperience[] }>;

export async function get(body: typeExperience_RequestDTO) {
return (await api.post<TypeExperienceGet_ResponseDTO>("/curriculum/typeExperience", {

Check warning on line 13 in src/services/UniversimeApi/TypeExperience.ts

View check run for this annotation

Codecov / codecov/patch

src/services/UniversimeApi/TypeExperience.ts#L12-L13

Added lines #L12 - L13 were not covered by tests
Expand Down

0 comments on commit abcc9d2

Please sign in to comment.