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

Development 1.1 telegram rule #390

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 1 addition & 3 deletions client/src/components/AddUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</v-col>
<v-col cols="6">
<v-text-field v-model="telegram_link" label="Telegram" density="comfortable"
:rules="telegramRules"></v-text-field>
:rules="requiredRules"></v-text-field>

<v-text-field v-model="birthday" label="Birthday" density="comfortable" :rules="requiredStringRules"
@click="toggleDatePicker('birthdayPicker')" readonly>
Expand Down Expand Up @@ -83,7 +83,6 @@ import {
mobileRules,
jobRules,
addressRules,
telegramRules,
requiredStringRules,
requiredRules
} from '@/utils'
Expand Down Expand Up @@ -252,7 +251,6 @@ export default {
mobileRules,
jobRules,
addressRules,
telegramRules,
requiredStringRules,
requiredRules,
isLoading,
Expand Down
4 changes: 1 addition & 3 deletions client/src/components/UpdateUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</v-col>
<v-col cols="6" v-if="selectedUser">
<v-text-field v-model="selectedUser.telegram_link" label="Telegram" density="comfortable"
:rules="telegramRules"></v-text-field>
:rules="requiredRules"></v-text-field>

<v-text-field v-model="selectedUser.birthday" label="Birthday" density="comfortable"
:rules="requiredStringRules" @click="toggleDatePicker('birthdayPicker')" readonly>
Expand Down Expand Up @@ -110,7 +110,6 @@ import {
mobileRules,
jobRules,
addressRules,
telegramRules,
requiredStringRules,
requiredRules,
formatDate,
Expand Down Expand Up @@ -281,7 +280,6 @@ export default {
addressRules,
supervisorPage,
supervisorCount,
telegramRules,
requiredStringRules,
requiredRules,
isLoading,
Expand Down
8 changes: 1 addition & 7 deletions client/src/utils/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,7 @@ export const addressRules = [
// (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.',
(v: string) => /^@([A-Za-z0-9_]{1,255})$/.test(v) || 'Telegram handle is not valid.',
(v: string) =>
(v && v.length >= 3 && v.length <= 50) || 'Telegram must be between 3 and 50 characters.'
]

export const requiredStringRules = [
(v: string) => typeof v === 'string' || 'This field must be a string.',
(v: string) => !!v || 'This field is required.'
Expand Down
Loading