Skip to content

Commit

Permalink
recheck and run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
bRight36691 committed Feb 25, 2025
1 parent 6c0833c commit 4dc85bd
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 41 deletions.
81 changes: 41 additions & 40 deletions cmd/migrate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,53 +13,54 @@ import (
func CreateEnum(db *gorm.DB) {
query := `
DO $$ BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = "lifestyle_tag") THEN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'lifestyle_tag') THEN
CREATE TYPE lifestyle_tag AS ENUM (
"Active",
"Creative",
"Social",
"Relaxed",
'Active',
'Creative',
'Social',
'Relaxed',
"Football",
"Basketball",
"Tennis",
"Swimming",
"Running",
"Cycling",
"Badminton",
"Yoga",
"Gym & Fitness",
'Football',
'Basketball',
'Tennis',
'Swimming',
'Running',
'Cycling',
'Badminton',
'Yoga',
'Gym & Fitness',
"Music",
"Dancing",
"Photography",
"Painting",
"Gaming",
"Reading",
"Writing",
"DIY & Crafting",
"Cooking",
'Music',
'Dancing',
'Photography',
'Painting',
'Gaming',
'Reading',
'Writing',
'DIY & Crafting',
'Cooking',
"Extrovert",
"Introvert",
"Night Owl",
"Early Bird",
'Extrovert',
'Introvert',
'Night Owl',
'Early Bird',
"Traveler",
"Backpacker",
"Nature Lover",
"Camping",
"Beach Lover",
'Traveler',
'Backpacker',
'Nature Lover',
'Camping',
'Beach Lover',
"Dog Lover",
"Cat Lover",
'Dog Lover',
'Cat Lover',
"Freelancer",
"Entrepreneur",
"Office Worker",
"Remote Worker",
"Student",
"Self-Employed");
'Freelancer',
'Entrepreneur',
'Office Worker',
'Remote Worker',
'Student',
'Self-Employed'
);
END IF;
END $$;
`
Expand Down
5 changes: 4 additions & 1 deletion internal/handlers/user_handler_update_user_information.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ func (h *UserHandler) UpdateUserInformation(c *fiber.Ctx) error {
}

validate := validator.New()
validate.RegisterValidation("lifestyle", utils.ValidateLifestyles)
lifestyle_err := validate.RegisterValidation("lifestyle", utils.ValidateLifestyles)
if lifestyle_err != nil {
return errorHandler.BadRequestError(err, "your lifestyle-tg is incorrect format")
}

if err := validate.Struct(requestBody); err != nil {
return errorHandler.BadRequestError(err, "your request body is incorrect")
Expand Down

0 comments on commit 4dc85bd

Please sign in to comment.