Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made application text optional #1675

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/samfundet/models/recruitment.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class RecruitmentPosition(CustomBaseModel):

is_funksjonaer_position = models.BooleanField(help_text='Is this a funksjonær position?')

default_application_letter_nb = models.TextField(help_text='Default application letter for the position')
default_application_letter_nb = models.TextField(help_text='Default application letter for the position', null=True, blank=True)
default_application_letter_en = models.TextField(help_text='Default application letter for the position', null=True, blank=True)

norwegian_applicants_only = models.BooleanField(help_text='Is this position only for Norwegian applicants?', default=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type { RecruitmentPositionDto, UserDto } from '~/dto';
import { KEY } from '~/i18n/constants';
import { reverse } from '~/named-urls';
import { ROUTES } from '~/routes';
import { NON_EMPTY_STRING } from '~/schema/strings';
import { NON_EMPTY_STRING, OPTIONAL_NON_EMPTY_STRING} from '~/schema/strings';
import styles from './RecruitmentPositionFormAdminPage.module.scss';

const schema = z.object({
Expand All @@ -35,8 +35,8 @@ const schema = z.object({
long_description_nb: NON_EMPTY_STRING,
long_description_en: NON_EMPTY_STRING,
is_funksjonaer_position: z.boolean(),
default_application_letter_nb: NON_EMPTY_STRING,
default_application_letter_en: NON_EMPTY_STRING,
default_application_letter_nb: OPTIONAL_NON_EMPTY_STRING,
default_application_letter_en: OPTIONAL_NON_EMPTY_STRING,
tags: NON_EMPTY_STRING,
interviewer_ids: z.array(z.number()).optional().nullable(),
});
Expand Down Expand Up @@ -67,6 +67,8 @@ export function RecruitmentPositionForm({ initialData, positionId, recruitmentId
gang: { id: Number.parseInt(gangId ?? '') },
recruitment: recruitmentId ?? '',
interviewer_ids: data.interviewer_ids || [],
default_application_letter_nb: data.default_application_letter_nb || '',
nemisis84 marked this conversation as resolved.
Show resolved Hide resolved
default_application_letter_en: data.default_application_letter_en || '',
};

const action = positionId
Expand Down
1 change: 1 addition & 0 deletions frontend/src/schema/strings.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { z } from 'zod';

export const NON_EMPTY_STRING = z.string().min(1);
export const OPTIONAL_NON_EMPTY_STRING = z.string().min(1).optional().or(z.literal(''));
Loading