mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-28 12:43:12 +08:00
[offers][chore] rename offers types
This commit is contained in:
@ -5,8 +5,7 @@ import { useState } from 'react';
|
||||
import ProfileComments from '~/components/offers/profile/ProfileComments';
|
||||
import ProfileDetails from '~/components/offers/profile/ProfileDetails';
|
||||
import ProfileHeader from '~/components/offers/profile/ProfileHeader';
|
||||
import type { OfferEntity } from '~/components/offers/types';
|
||||
import type { BackgroundCard } from '~/components/offers/types';
|
||||
import type { BackgroundCard, OfferEntity } from '~/components/offers/types';
|
||||
|
||||
import { convertCurrencyToString } from '~/utils/offers/currency';
|
||||
import { formatDate } from '~/utils/offers/time';
|
||||
@ -44,25 +43,25 @@ export default function OfferProfile() {
|
||||
if (data?.offers) {
|
||||
const filteredOffers: Array<OfferEntity> = data
|
||||
? data?.offers.map((res) => {
|
||||
if (res.OffersFullTime) {
|
||||
if (res.OfferFullTime) {
|
||||
const filteredOffer: OfferEntity = {
|
||||
base: convertCurrencyToString(
|
||||
res.OffersFullTime.baseSalary.value,
|
||||
res.OfferFullTime.baseSalary,
|
||||
),
|
||||
bonus: convertCurrencyToString(
|
||||
res.OffersFullTime.bonus.value,
|
||||
res.OfferFullTime.bonus,
|
||||
),
|
||||
companyName: res.company.name,
|
||||
id: res.OffersFullTime.id,
|
||||
jobLevel: res.OffersFullTime.level,
|
||||
jobTitle: res.OffersFullTime.title,
|
||||
id: res.OfferFullTime.id,
|
||||
jobLevel: res.OfferFullTime.level,
|
||||
jobTitle: res.OfferFullTime.title,
|
||||
location: res.location,
|
||||
negotiationStrategy: res.negotiationStrategy || '',
|
||||
otherComment: res.comments || '',
|
||||
receivedMonth: formatDate(res.monthYearReceived),
|
||||
stocks: convertCurrencyToString(res.OffersFullTime.stocks),
|
||||
stocks: convertCurrencyToString(res.OfferFullTime.stocks),
|
||||
totalCompensation: convertCurrencyToString(
|
||||
res.OffersFullTime.totalCompensation,
|
||||
res.OfferFullTime.totalCompensation,
|
||||
),
|
||||
};
|
||||
|
||||
@ -70,11 +69,11 @@ export default function OfferProfile() {
|
||||
}
|
||||
const filteredOffer: OfferEntity = {
|
||||
companyName: res.company.name,
|
||||
id: res.OffersIntern!.id,
|
||||
jobTitle: res.OffersIntern!.title,
|
||||
id: res.OfferIntern!.id,
|
||||
jobTitle: res.OfferIntern!.title,
|
||||
location: res.location,
|
||||
monthlySalary: convertCurrencyToString(
|
||||
res.OffersIntern!.monthlySalary,
|
||||
res.OfferIntern!.monthlySalary,
|
||||
),
|
||||
negotiationStrategy: res.negotiationStrategy || '',
|
||||
otherComment: res.comments || '',
|
||||
|
@ -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(
|
||||
[
|
||||
`offers.profile.listOne`,
|
||||
{
|
||||
profileId,
|
||||
token:
|
||||
'afca11e436d21bde24543718fa957c6c625335439dc504f24ee35eae7b5ef1ba',
|
||||
'e7effd2a40adba2deb1ddea4fb9f1e6c3c98ab0a85a88ed1567fc2a107fdb445',
|
||||
},
|
||||
],
|
||||
{
|
||||
@ -208,7 +208,7 @@ function Test() {
|
||||
);
|
||||
|
||||
const replies = trpc.useQuery(
|
||||
['offers.comments.getComments', { profileId: 'cl96stky5002ew32gx2kale2x' }],
|
||||
['offers.comments.getComments', { profileId }],
|
||||
{
|
||||
onError(err) {
|
||||
setError(err.shape?.message || '');
|
||||
@ -221,7 +221,7 @@ function Test() {
|
||||
const handleDelete = (id: string) => {
|
||||
deleteMutation.mutate({
|
||||
profileId: id,
|
||||
token: 'afca11e436d21bde24543718fa957c6c625335439dc504f24ee35eae7b5ef1ba',
|
||||
token: 'e7effd2a40adba2deb1ddea4fb9f1e6c3c98ab0a85a88ed1567fc2a107fdb445',
|
||||
});
|
||||
};
|
||||
|
||||
|
13
apps/portal/src/types/offers-profile.d.ts
vendored
13
apps/portal/src/types/offers-profile.d.ts
vendored
@ -67,9 +67,9 @@ export type SpecificYoe = {
|
||||
yoe: number;
|
||||
}
|
||||
|
||||
export type Offers = {
|
||||
OffersFullTime?: OffersFullTime | null;
|
||||
OffersIntern?: OffersIntern | null;
|
||||
export type Offer = {
|
||||
OfferFullTime?: OfferFullTime | null;
|
||||
OfferIntern?: OfferIntern | null;
|
||||
comments?: string | null;
|
||||
company: Company;
|
||||
companyId: string;
|
||||
@ -83,7 +83,7 @@ export type Offers = {
|
||||
profileId: string;
|
||||
}
|
||||
|
||||
export type OffersFullTime = {
|
||||
export type OfferFullTime = {
|
||||
baseSalary: Valuation;
|
||||
baseSalaryId: string;
|
||||
bonus: Valuation;
|
||||
@ -93,18 +93,19 @@ export type OffersFullTime = {
|
||||
specialization: string;
|
||||
stocks: Valuation;
|
||||
stocksId: string;
|
||||
title?: string | null;
|
||||
title?: string;
|
||||
totalCompensation: Valuation;
|
||||
totalCompensationId: string;
|
||||
}
|
||||
|
||||
export type OffersIntern = {
|
||||
export type OfferIntern = {
|
||||
id: string;
|
||||
internshipCycle: string;
|
||||
monthlySalary: Valuation;
|
||||
monthlySalaryId: string;
|
||||
specialization: string;
|
||||
startYear: number;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export type Reply = {
|
||||
|
Reference in New Issue
Block a user