[offers][chore] rename offers types

This commit is contained in:
Stuart Long Chay Boon
2022-10-15 12:51:56 +08:00
parent 0666c99151
commit 44f4454d96
3 changed files with 23 additions and 23 deletions

View File

@ -5,8 +5,7 @@ import { useState } from 'react';
import ProfileComments from '~/components/offers/profile/ProfileComments'; import ProfileComments from '~/components/offers/profile/ProfileComments';
import ProfileDetails from '~/components/offers/profile/ProfileDetails'; import ProfileDetails from '~/components/offers/profile/ProfileDetails';
import ProfileHeader from '~/components/offers/profile/ProfileHeader'; import ProfileHeader from '~/components/offers/profile/ProfileHeader';
import type { OfferEntity } from '~/components/offers/types'; import type { BackgroundCard, OfferEntity } from '~/components/offers/types';
import type { BackgroundCard } from '~/components/offers/types';
import { convertCurrencyToString } from '~/utils/offers/currency'; import { convertCurrencyToString } from '~/utils/offers/currency';
import { formatDate } from '~/utils/offers/time'; import { formatDate } from '~/utils/offers/time';
@ -44,25 +43,25 @@ export default function OfferProfile() {
if (data?.offers) { if (data?.offers) {
const filteredOffers: Array<OfferEntity> = data const filteredOffers: Array<OfferEntity> = data
? data?.offers.map((res) => { ? data?.offers.map((res) => {
if (res.OffersFullTime) { if (res.OfferFullTime) {
const filteredOffer: OfferEntity = { const filteredOffer: OfferEntity = {
base: convertCurrencyToString( base: convertCurrencyToString(
res.OffersFullTime.baseSalary.value, res.OfferFullTime.baseSalary,
), ),
bonus: convertCurrencyToString( bonus: convertCurrencyToString(
res.OffersFullTime.bonus.value, res.OfferFullTime.bonus,
), ),
companyName: res.company.name, companyName: res.company.name,
id: res.OffersFullTime.id, id: res.OfferFullTime.id,
jobLevel: res.OffersFullTime.level, jobLevel: res.OfferFullTime.level,
jobTitle: res.OffersFullTime.title, jobTitle: res.OfferFullTime.title,
location: res.location, location: res.location,
negotiationStrategy: res.negotiationStrategy || '', negotiationStrategy: res.negotiationStrategy || '',
otherComment: res.comments || '', otherComment: res.comments || '',
receivedMonth: formatDate(res.monthYearReceived), receivedMonth: formatDate(res.monthYearReceived),
stocks: convertCurrencyToString(res.OffersFullTime.stocks), stocks: convertCurrencyToString(res.OfferFullTime.stocks),
totalCompensation: convertCurrencyToString( totalCompensation: convertCurrencyToString(
res.OffersFullTime.totalCompensation, res.OfferFullTime.totalCompensation,
), ),
}; };
@ -70,11 +69,11 @@ export default function OfferProfile() {
} }
const filteredOffer: OfferEntity = { const filteredOffer: OfferEntity = {
companyName: res.company.name, companyName: res.company.name,
id: res.OffersIntern!.id, id: res.OfferIntern!.id,
jobTitle: res.OffersIntern!.title, jobTitle: res.OfferIntern!.title,
location: res.location, location: res.location,
monthlySalary: convertCurrencyToString( monthlySalary: convertCurrencyToString(
res.OffersIntern!.monthlySalary, res.OfferIntern!.monthlySalary,
), ),
negotiationStrategy: res.negotiationStrategy || '', negotiationStrategy: res.negotiationStrategy || '',
otherComment: res.comments || '', otherComment: res.comments || '',

View File

@ -190,14 +190,14 @@ function Test() {
}); });
}; };
const profileId = 'cl96stky5002ew32gx2kale2x'; // Remember to change this filed after testing deleting const profileId = 'cl99fhrsf00007ijpbrdk8gue'; // Remember to change this filed after testing deleting
const data = trpc.useQuery( const data = trpc.useQuery(
[ [
`offers.profile.listOne`, `offers.profile.listOne`,
{ {
profileId, profileId,
token: token:
'afca11e436d21bde24543718fa957c6c625335439dc504f24ee35eae7b5ef1ba', 'e7effd2a40adba2deb1ddea4fb9f1e6c3c98ab0a85a88ed1567fc2a107fdb445',
}, },
], ],
{ {
@ -208,7 +208,7 @@ function Test() {
); );
const replies = trpc.useQuery( const replies = trpc.useQuery(
['offers.comments.getComments', { profileId: 'cl96stky5002ew32gx2kale2x' }], ['offers.comments.getComments', { profileId }],
{ {
onError(err) { onError(err) {
setError(err.shape?.message || ''); setError(err.shape?.message || '');
@ -221,7 +221,7 @@ function Test() {
const handleDelete = (id: string) => { const handleDelete = (id: string) => {
deleteMutation.mutate({ deleteMutation.mutate({
profileId: id, profileId: id,
token: 'afca11e436d21bde24543718fa957c6c625335439dc504f24ee35eae7b5ef1ba', token: 'e7effd2a40adba2deb1ddea4fb9f1e6c3c98ab0a85a88ed1567fc2a107fdb445',
}); });
}; };

View File

@ -67,9 +67,9 @@ export type SpecificYoe = {
yoe: number; yoe: number;
} }
export type Offers = { export type Offer = {
OffersFullTime?: OffersFullTime | null; OfferFullTime?: OfferFullTime | null;
OffersIntern?: OffersIntern | null; OfferIntern?: OfferIntern | null;
comments?: string | null; comments?: string | null;
company: Company; company: Company;
companyId: string; companyId: string;
@ -83,7 +83,7 @@ export type Offers = {
profileId: string; profileId: string;
} }
export type OffersFullTime = { export type OfferFullTime = {
baseSalary: Valuation; baseSalary: Valuation;
baseSalaryId: string; baseSalaryId: string;
bonus: Valuation; bonus: Valuation;
@ -93,18 +93,19 @@ export type OffersFullTime = {
specialization: string; specialization: string;
stocks: Valuation; stocks: Valuation;
stocksId: string; stocksId: string;
title?: string | null; title?: string;
totalCompensation: Valuation; totalCompensation: Valuation;
totalCompensationId: string; totalCompensationId: string;
} }
export type OffersIntern = { export type OfferIntern = {
id: string; id: string;
internshipCycle: string; internshipCycle: string;
monthlySalary: Valuation; monthlySalary: Valuation;
monthlySalaryId: string; monthlySalaryId: string;
specialization: string; specialization: string;
startYear: number; startYear: number;
title?: string;
} }
export type Reply = { export type Reply = {