Skip to content

Commit

Permalink
fix renames
Browse files Browse the repository at this point in the history
  • Loading branch information
magsyg committed Nov 12, 2024
1 parent e59f88e commit 657a223
Show file tree
Hide file tree
Showing 20 changed files with 57 additions and 59 deletions.
4 changes: 2 additions & 2 deletions backend/samfundet/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

########## Recruitment ##########
router.register('recruitment', views.RecruitmentView, 'recruitment')
router.register('recruitment-sharedinterviewgroup', views.RecruitmentSharedInterviewGroupView, 'recruitment_sharedinterviewgroups')
router.register('recruitment-sharedinterviewgroup', views.RecruitmentSharedInterviewPositionsView, 'recruitment_sharedinterviewgroups')
router.register('recruitment-for-recruiter', views.RecruitmentForRecruiterView, 'recruitment_for_recruiter')
router.register('recruitment-stats', views.RecruitmentStatisticsView, 'recruitment_stats')
router.register('recruitment-separateposition', views.RecruitmentSeparatePositionView, 'recruitment_separateposition')
Expand Down Expand Up @@ -91,7 +91,7 @@
),
path(
'recruitment-shared-interview-groups/<int:recruitment_id>/',
views.RecruitmentInterviewGroupRecruitmentView.as_view(),
views.RecruitmentSharedInterviewPositionsRecruitmentView.as_view(),
name='recruitment_shared_interviews',
),
path('recruitment-positions-gang-for-gangs/', views.RecruitmentPositionsPerGangForGangView.as_view(), name='recruitment_positions_gang_for_gangs'),
Expand Down
4 changes: 2 additions & 2 deletions backend/samfundet/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ class RecruitmentForRecruiterView(ModelViewSet):


@method_decorator(ensure_csrf_cookie, 'dispatch')
class RecruitmentSharedInterviewGroupView(ModelViewSet):
class RecruitmentSharedInterviewPositionsView(ModelViewSet):
permission_classes = (DjangoModelPermissionsOrAnonReadOnly,)
serializer_class = RecruitmentPositionSharedInterviewGroupSerializer
queryset = RecruitmentPositionSharedInterviewGroup.objects.all()
Expand Down Expand Up @@ -1138,7 +1138,7 @@ def get_queryset(self) -> Response:
return Recruitment.objects.filter(visible_from__lte=timezone.now(), actual_application_deadline__gte=timezone.now())


class RecruitmentInterviewGroupRecruitmentView(APIView):
class RecruitmentSharedInterviewPositionsRecruitmentView(APIView):
permission_classes = [IsAuthenticated]

def get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { reverse } from '~/named-urls';
import { ROUTES } from '~/routes';
import { dbT, lowerCapitalize } from '~/utils';
import { AdminPageLayout } from '../AdminPageLayout/AdminPageLayout';
import { AppletContainer, RecruitmentInterviewGroupsList } from './components';
import { AppletContainer, RecruitmentSharedInterviewPositionsList } from './components';

import styles from './RecruitmentGangOverviewPage.module.scss';

Expand Down Expand Up @@ -131,7 +131,6 @@ export function RecruitmentGangOverviewPage() {
label: t(KEY.recruitment_interview_groups),
value: (
<>
<RecruitmentInterviewGroupsList />
<Button
className={styles.button}
theme="success"
Expand All @@ -143,6 +142,7 @@ export function RecruitmentGangOverviewPage() {
>
{lowerCapitalize(`${t(KEY.common_create)} ${t(KEY.recruitment_interview_group)}`)}
</Button>{' '}
<RecruitmentSharedInterviewPositionsList />
</>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import { toast } from 'react-toastify';
import { getRecruitmentSharedInterviewGroups, getRecruitmentStats } from '~/api';
import type { RecruitmentSharedInterviewGroupDto, RecruitmentStatsDto } from '~/dto';
import { getRecruitmentSharedInterviewPositionss, getRecruitmentStats } from '~/api';
import type { RecruitmentSharedInterviewPositionsDto, RecruitmentStatsDto } from '~/dto';
import { KEY } from '~/i18n/constants';
import styles from './RecruitmentInterviewGroupsList.module.scss';
import { RecruitmentInterviewGroupComponent } from './components/RecruitmentInterviewGroupComponent/RecruitmentInterviewGroupComponent';
import styles from './RecruitmentSharedInterviewPositionsList.module.scss';
import { RecruitmentSharedInterviewPositionsComponent } from './components/RecruitmentSharedInterviewPositionsComponent/RecruitmentSharedInterviewPositionsComponent';

export function RecruitmentInterviewGroupsList() {
export function RecruitmentSharedInterviewPositionsList() {
const { recruitmentId } = useParams();
const [interviewGroups, setInterviewGroups] = useState<RecruitmentSharedInterviewGroupDto[]>();
const [interviewGroups, setInterviewGroups] = useState<RecruitmentSharedInterviewPositionsDto[]>();
const { t } = useTranslation();

useEffect(() => {
if (recruitmentId) {
getRecruitmentSharedInterviewGroups(recruitmentId)
getRecruitmentSharedInterviewPositionss(recruitmentId)
.then((response) => {
setInterviewGroups(response.data);
})
Expand All @@ -28,8 +28,8 @@ export function RecruitmentInterviewGroupsList() {

return (
<div className={styles.container}>
{interviewGroups?.map((interviewGroup: RecruitmentSharedInterviewGroupDto) => {
return <RecruitmentInterviewGroupComponent interviewGroup={interviewGroup} key={interviewGroup.id} />;
{interviewGroups?.map((interviewGroup: RecruitmentSharedInterviewPositionsDto) => {
return <RecruitmentSharedInterviewPositionsComponent interviewGroup={interviewGroup} key={interviewGroup.id} />;
})}
</div>
);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { useTranslation } from 'react-i18next';
import { Button, ExpandableHeader, Table } from '~/Components';
import type { RecruitmentSharedInterviewGroupDto, RecruitmentStatsDto } from '~/dto';
import type { RecruitmentSharedInterviewPositionsDto, RecruitmentStatsDto } from '~/dto';
import { KEY } from '~/i18n/constants';
import { reverse } from '~/named-urls';
import { ROUTES } from '~/routes';
import { dbT } from '~/utils';
import styles from './RecruitmentInterviewGroupComponent.module.scss';
import styles from './RecruitmentSharedInterviewPositionsComponent.module.scss';

type RecruitmentInterviewGroupComponentProps = {
interviewGroup: RecruitmentSharedInterviewGroupDto;
type RecruitmentSharedInterviewPositionsComponentProps = {
interviewGroup: RecruitmentSharedInterviewPositionsDto;
};

export function RecruitmentInterviewGroupComponent({ interviewGroup }: RecruitmentInterviewGroupComponentProps) {
export function RecruitmentSharedInterviewPositionsComponent({ interviewGroup }: RecruitmentSharedInterviewPositionsComponentProps) {
const interviewGroupHeader = dbT(interviewGroup, 'name') ?? 'N/A';
const { t } = useTranslation();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { RecruitmentSharedInterviewPositionsComponent } from './RecruitmentSharedInterviewPositionsComponent';
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { AppletCard } from './AppletCard/AppletCard';
export { AppletContainer } from './AppletContainer/AppletContainer';
export { RecruitmentInterviewGroupsList } from './RecruitmentInterviewGroupsList/RecruitmentInterviewGroupsList';
export { RecruitmentSharedInterviewPositionsList } from './RecruitmentInterviewGroupsList/RecruitmentSharedInterviewPositionsList';

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import type { DropdownOption } from '~/Components/Dropdown/Dropdown';
import { MultiSelect } from '~/Components/MultiSelect';
import {
getRecruitmentPositions,
postRecruitmentSharedInterviewGroup,
postRecruitmentSharedInterviewPositions,
putRecruitmentPosition,
putRecruitmentSharedInterviewGroup,
putRecruitmentSharedInterviewPositions,
} from '~/api';
import { KEY } from '~/i18n/constants';
import { reverse } from '~/named-urls';
import { ROUTES } from '~/routes';
import { NON_EMPTY_STRING } from '~/schema/strings';
import styles from './RecruitmentInterviewGroupFormAdminPage.module.scss';
import styles from './RecruitmentSharedInterviewPositionsFormAdminPage.module.scss';

const schema = z.object({
name_nb: NON_EMPTY_STRING,
Expand All @@ -46,7 +46,7 @@ interface FormProps {
recruitmentId?: string;
}

export function RecruitmentInterviewGroupForm({ initialData, recruitmentId, sharedInterviewGroupId }: FormProps) {
export function RecruitmentSharedInterviewPositionsForm({ initialData, recruitmentId, sharedInterviewGroupId }: FormProps) {
const { t } = useTranslation();
const navigate = useNavigate();

Expand All @@ -59,9 +59,6 @@ export function RecruitmentInterviewGroupForm({ initialData, recruitmentId, shar

const submitText = sharedInterviewGroupId ? t(KEY.common_save) : t(KEY.common_create);

useEffect(() => {
console.log(initialData);
}, [initialData]);

useEffect(() => {
if (recruitmentId) {
Expand All @@ -88,8 +85,8 @@ export function RecruitmentInterviewGroupForm({ initialData, recruitmentId, shar
};

const action = sharedInterviewGroupId
? putRecruitmentSharedInterviewGroup(sharedInterviewGroupId, updatedSharedInterviewGroup)
: postRecruitmentSharedInterviewGroup(updatedSharedInterviewGroup);
? putRecruitmentSharedInterviewPositions(sharedInterviewGroupId, updatedSharedInterviewGroup)
: postRecruitmentSharedInterviewPositions(updatedSharedInterviewGroup);

action
.then(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate, useParams } from 'react-router-dom';
import { toast } from 'react-toastify';
import { getRecruitmentSharedInterviewGroup } from '~/api';
import type { RecruitmentSharedInterviewGroupDto, RecruitmentSharedInterviewGroupPostDto } from '~/dto';
import { getRecruitmentSharedInterviewPositions } from '~/api';
import type { RecruitmentSharedInterviewPositionsDto, RecruitmentSharedInterviewPositionsPostDto } from '~/dto';
import { useTitle } from '~/hooks';
import { KEY } from '~/i18n/constants';
import { reverse } from '~/named-urls';
import { ROUTES } from '~/routes';
import { dbT } from '~/utils';
import { AdminPageLayout } from '../AdminPageLayout/AdminPageLayout';
import { RecruitmentInterviewGroupForm } from './RecruitmentInterviewGroupForm';
import { RecruitmentSharedInterviewPositionsForm } from './RecruitmentSharedInterviewPositionsForm';

export function RecruitmentInterviewGroupFormAdminPage() {
export function RecruitmentSharedInterviewPositionsFormAdminPage() {
const { t } = useTranslation();
const navigate = useNavigate();
const { recruitmentId, sharedInterviewGroupId } = useParams();
const [sharedInterview, setSharedInterview] = useState<Partial<RecruitmentSharedInterviewGroupDto>>();
const [sharedInterview, setSharedInterview] = useState<Partial<RecruitmentSharedInterviewPositionsDto>>();

useEffect(() => {
if (sharedInterviewGroupId && recruitmentId) {
getRecruitmentSharedInterviewGroup(sharedInterviewGroupId)
getRecruitmentSharedInterviewPositions(sharedInterviewGroupId)
.then((data) => {
setSharedInterview(data.data);
})
Expand All @@ -37,7 +37,7 @@ export function RecruitmentInterviewGroupFormAdminPage() {
}
}, [sharedInterviewGroupId, recruitmentId, navigate, t]);

const initialData: Partial<RecruitmentSharedInterviewGroupPostDto> = {
const initialData: Partial<RecruitmentSharedInterviewPositionsPostDto> = {
name_nb: sharedInterview?.name_nb || '',
name_en: sharedInterview?.name_en || '',
recruitment: recruitmentId,
Expand All @@ -52,7 +52,7 @@ export function RecruitmentInterviewGroupFormAdminPage() {

return (
<AdminPageLayout title={title} header={true}>
<RecruitmentInterviewGroupForm
<RecruitmentSharedInterviewPositionsForm
initialData={initialData}
sharedInterviewGroupId={sharedInterviewGroupId}
recruitmentId={recruitmentId}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { RecruitmentSharedInterviewPositionsFormAdminPage } from './RecruitmentSharedInterviewPositionsFormAdminPage';
2 changes: 1 addition & 1 deletion frontend/src/PagesAdmin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export { RecruitmentGangAllApplicantsAdminPage } from './RecruitmentGangAllAppli
export { RecruitmentGangOverviewPage } from './RecruitmentGangOverviewPage';
export { RecruitmentOpenToOtherPositionsPage } from './RecruitmentOpenToOtherPositionsPage';
export { RecruitmentOverviewPage } from './RecruitmentOverviewPage';
export { RecruitmentInterviewGroupFormAdminPage } from './RecruitmentInterviewGroupFormAdminPage';
export { RecruitmentSharedInterviewPositionsFormAdminPage } from './RecruitmentSharedInterviewPositionsFormAdminPage';
export { RecruitmentPositionFormAdminPage } from './RecruitmentPositionFormAdminPage';
export { RecruitmentPositionOverviewPage } from './RecruitmentPositionOverviewPage';
export { RecruitmentRecruiterDashboardPage } from './RecruitmentRecruiterDashboardPage';
Expand Down
20 changes: 10 additions & 10 deletions frontend/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import type {
RecruitmentPositionPostDto,
RecruitmentPositionPutDto,
RecruitmentSeparatePositionDto,
RecruitmentSharedInterviewGroupDto,
RecruitmentSharedInterviewGroupPostDto,
RecruitmentSharedInterviewPositionsDto,
RecruitmentSharedInterviewPositionsPostDto,
RecruitmentStatsDto,
RecruitmentUnprocessedApplicationsDto,
RecruitmentUserDto,
Expand Down Expand Up @@ -820,9 +820,9 @@ export async function getRecruitmentApplicationsForGang(
return await axios.get(url, { withCredentials: true });
}

export async function getRecruitmentSharedInterviewGroups(
export async function getRecruitmentSharedInterviewPositionss(
recruitmentId: string,
): Promise<AxiosResponse<RecruitmentSharedInterviewGroupDto[]>> {
): Promise<AxiosResponse<RecruitmentSharedInterviewPositionsDto[]>> {
const url =
BACKEND_DOMAIN +
reverse({
Expand All @@ -834,9 +834,9 @@ export async function getRecruitmentSharedInterviewGroups(
return await axios.get(url, { withCredentials: true });
}

export async function getRecruitmentSharedInterviewGroup(
export async function getRecruitmentSharedInterviewPositions(
sharedInterviewGroupId: string,
): Promise<AxiosResponse<RecruitmentSharedInterviewGroupDto>> {
): Promise<AxiosResponse<RecruitmentSharedInterviewPositionsDto>> {
const url =
BACKEND_DOMAIN +
reverse({
Expand All @@ -848,9 +848,9 @@ export async function getRecruitmentSharedInterviewGroup(
return await axios.get(url, { withCredentials: true });
}

export async function putRecruitmentSharedInterviewGroup(
export async function putRecruitmentSharedInterviewPositions(
sharedInterviewGroupId: string,
sharedInterviewGroup: Partial<RecruitmentSharedInterviewGroupPostDto>,
sharedInterviewGroup: Partial<RecruitmentSharedInterviewPositionsPostDto>,
): Promise<AxiosResponse> {
const url =
BACKEND_DOMAIN +
Expand All @@ -863,8 +863,8 @@ export async function putRecruitmentSharedInterviewGroup(
return await axios.put<RecruitmentApplicationDto>(url, sharedInterviewGroup, { withCredentials: true });
}

export async function postRecruitmentSharedInterviewGroup(
sharedInterviewGroup: Partial<RecruitmentSharedInterviewGroupPostDto>,
export async function postRecruitmentSharedInterviewPositions(
sharedInterviewGroup: Partial<RecruitmentSharedInterviewPositionsPostDto>,
): Promise<AxiosResponse> {
const url =
BACKEND_DOMAIN +
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,15 @@ export type RecruitmentSeparatePositionDto = {
recruitment?: string;
};

export type RecruitmentSharedInterviewGroupDto = {
export type RecruitmentSharedInterviewPositionsDto = {
id?: number;
recruitment?: string;
name_nb: string;
name_en: string;
positions: RecruitmentPositionDto[];
};

export type RecruitmentSharedInterviewGroupPostDto = Omit<RecruitmentSharedInterviewGroupDto, 'positions'> & {
export type RecruitmentSharedInterviewPositionsPostDto = Omit<RecruitmentSharedInterviewPositionsDto, 'positions'> & {
positions: number[];
};

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/router/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {
RecruitmentGangAdminPage,
RecruitmentGangAllApplicantsAdminPage,
RecruitmentGangOverviewPage,
RecruitmentInterviewGroupFormAdminPage,
RecruitmentSharedInterviewPositionsFormAdminPage,
RecruitmentOpenToOtherPositionsPage,
RecruitmentOverviewPage,
RecruitmentPositionFormAdminPage,
Expand Down Expand Up @@ -378,11 +378,11 @@ export const router = createBrowserRouter(
/>
<Route
path={ROUTES.frontend.admin_recruitment_sharedinterviewgroup_create}
element={<PermissionRoute required={[]} element={<RecruitmentInterviewGroupFormAdminPage />} />}
element={<PermissionRoute required={[]} element={<RecruitmentSharedInterviewPositionsFormAdminPage />} />}
/>
<Route
path={ROUTES.frontend.admin_recruitment_sharedinterviewgroup_edit}
element={<PermissionRoute required={[]} element={<RecruitmentInterviewGroupFormAdminPage />} />}
element={<PermissionRoute required={[]} element={<RecruitmentSharedInterviewPositionsFormAdminPage />} />}
/>
<Route
path={ROUTES.frontend.admin_recruitment_room_overview}
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/routes/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ export const ROUTES_BACKEND = {
samfundet__recruitment_list: '/api/recruitment/',
samfundet__recruitment_detail: '/api/recruitment/:pk/',
samfundet__recruitment_gangs: '/api/recruitment/:pk/gangs/',
samfundet__recruitment_sharedinterviewgroups_list: '/api/recruitmentSharedInterviewGroup/',
samfundet__recruitment_sharedinterviewgroups_detail: '/api/recruitmentSharedInterviewGroup/:pk/',
samfundet__recruitment_sharedinterviewgroups_list: '/api/recruitment-sharedinterviewgroup/',
samfundet__recruitment_sharedinterviewgroups_detail: '/api/recruitment-sharedinterviewgroup/:pk/',
samfundet__recruitment_for_recruiter_list: '/api/recruitment-for-recruiter/',
samfundet__recruitment_for_recruiter_detail: '/api/recruitment-for-recruiter/:pk/',
samfundet__recruitment_stats_list: '/api/recruitment-stats/',
Expand All @@ -566,6 +566,7 @@ export const ROUTES_BACKEND = {
samfundet__interview_list: '/api/interview/',
samfundet__interview_detail: '/api/interview/:pk/',
samfundet__api_root: '/api/',
samfundet__api_root: '/api/:format',
samfundet__schema: '/schema/',
samfundet__swagger_ui: '/schema/swagger-ui/',
samfundet__redoc: '/schema/redoc/',
Expand Down Expand Up @@ -611,4 +612,4 @@ export const ROUTES_BACKEND = {
samfundet__purchase_feedback: '/purchase-feedback/',
static__path: '/static/:path',
media__path: '/media/:path',
} as const;
} as const;

0 comments on commit 657a223

Please sign in to comment.