From 2d18ccd36c9df62158d247c342833b5551f0cffb Mon Sep 17 00:00:00 2001 From: Mahmoud Emad Date: Tue, 12 Mar 2024 13:36:17 +0200 Subject: [PATCH] Fix: make the social_insurance_number field optional. --- client/src/components/AddUser.vue | 5 +---- client/src/components/UpdateUser.vue | 4 +--- client/src/utils/validators.ts | 12 ++++++------ server/cshr/models/users.py | 2 +- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/client/src/components/AddUser.vue b/client/src/components/AddUser.vue index 3eca35540..dd3534f6a 100644 --- a/client/src/components/AddUser.vue +++ b/client/src/components/AddUser.vue @@ -14,7 +14,7 @@ + density="comfortable"> + density="comfortable"> (v && v.length >= 3 && v.length <= 50) || 'Address must be between 3 and 50 characters.' ] -export const socialInsuranceRules = [ - (v: string) => typeof v === 'string' || 'Social Number must be a string.', - (v: string) => !!v || 'Social Number is required.', - (v: string) => - (v && v.length >= 3 && v.length <= 50) || 'Social Number must be between 3 and 50 characters.' -] +// export const socialInsuranceRules = [ +// (v: string) => typeof v === 'string' || 'Social Number must be a string.', +// (v: string) => !!v || 'Social Number is required.', +// (v: string) => +// (v && v.length >= 3 && v.length <= 50) || 'Social Number must be between 3 and 50 characters.' +// ] export const telegramRules = [ (v: string) => typeof v === 'string' || 'Telegram must be a string.', (v: string) => !!v || 'Telegram is required.', diff --git a/server/cshr/models/users.py b/server/cshr/models/users.py index 56d5529f6..c8ccdedc8 100644 --- a/server/cshr/models/users.py +++ b/server/cshr/models/users.py @@ -101,7 +101,7 @@ class User(AbstractBaseUser, TimeStamp): skills = models.ManyToManyField(UserSkills, related_name="skills", blank=True) user_type = models.CharField(max_length=20, choices=USER_TYPE.choices) gender = models.CharField(max_length=20, choices=GENDER_TYPE.choices) - social_insurance_number = models.CharField(max_length=45) + social_insurance_number = models.CharField(max_length=45, null=True, blank=True) address = models.CharField(max_length=150) job_title = models.CharField(max_length=150) USERNAME_FIELD = "email"