Skip to content

Commit

Permalink
feat: change JSON fields to camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
litsynp committed Mar 2, 2024
1 parent 45554ba commit 1e7aae3
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion api/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
type PaginatedView[T interface{}] struct {
Page int `json:"page"`
Size int `json:"size"`
IsLastPage bool `json:"is_last_page"`
IsLastPage bool `json:"isLastPage"`
Items []T `json:"items"`
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

// @title 이웃집멍냥 API 문서
// @version 0.8.0
// @version 0.9.0
// @description 이웃집멍냥 백엔드 API 문서입니다.
// @termsOfService http://swagger.io/terms/

Expand Down
14 changes: 7 additions & 7 deletions internal/domain/pet/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ type AddPetsToOwnerRequest struct {

type AddPetRequest struct {
Name string `json:"name" validate:"required"`
PetType PetType `json:"pet_type" validate:"required,oneof=dog cat"`
PetType PetType `json:"petType" validate:"required,oneof=dog cat"`
Sex PetSex `json:"sex" validate:"required,oneof=male female"`
Neutered bool `json:"neutered" validate:"required"`
Breed string `json:"breed" validate:"required"`
BirthDate string `json:"birth_date" validate:"required"`
WeightInKg float64 `json:"weight_in_kg" validate:"required"`
BirthDate string `json:"birthDate" validate:"required"`
WeightInKg float64 `json:"weightInKg" validate:"required"`
}

type FindMyPetsView struct {
Expand All @@ -23,17 +23,17 @@ type FindMyPetsView struct {
type PetView struct {
ID int `json:"id"`
Name string `json:"name"`
PetType PetType `json:"pet_type"`
PetType PetType `json:"petType"`
Sex PetSex `json:"sex"`
Neutered bool `json:"neutered"`
Breed string `json:"breed"`
BirthDate string `json:"birth_date"`
WeightInKg float64 `json:"weight_in_kg"`
BirthDate string `json:"birthDate"`
WeightInKg float64 `json:"weightInKg"`
}

type BreedView struct {
ID int `json:"id"`
PetType PetType `json:"pet_type"`
PetType PetType `json:"petType"`
Name string `json:"name"`
}

Expand Down
84 changes: 42 additions & 42 deletions internal/domain/sos_post/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,34 @@ import (
type WriteSosPostRequest struct {
Title string `json:"title" validate:"required"`
Content string `json:"content" validate:"required"`
ImageIDs []int `json:"image_ids" validate:"required"`
ImageIDs []int `json:"imageIds" validate:"required"`
Reward string `json:"reward" validate:"required"`
DateStartAt time.Time `json:"date_start_at" validate:"required"`
DateEndAt time.Time `json:"date_end_at" validate:"required"`
CareType CareType `json:"care_type" validate:"required,oneof= foster visiting"`
CarerGender CarerGender `json:"carer_gender" validate:"required,oneof=male female all"`
RewardAmount RewardAmount `json:"reward_amount" validate:"required,oneof=hour"`
ConditionIDs []int `json:"condition_ids"`
PetIDs []int `json:"pet_ids"`
DateStartAt time.Time `json:"dateStartAt" validate:"required"`
DateEndAt time.Time `json:"dateEndAt" validate:"required"`
CareType CareType `json:"careType" validate:"required,oneof= foster visiting"`
CarerGender CarerGender `json:"carerGender" validate:"required,oneof=male female all"`
RewardAmount RewardAmount `json:"rewardAmount" validate:"required,oneof=hour"`
ConditionIDs []int `json:"conditionIds"`
PetIDs []int `json:"petIds"`
}

type WriteSosPostView struct {
ID int `json:"id"`
AuthorID int `json:"author_id"`
AuthorID int `json:"authorId"`
Title string `json:"title"`
Content string `json:"content"`
Media []media.MediaView `json:"media"`
Conditions []ConditionView `json:"conditions"`
Pets []pet.PetView `json:"pets"`
Reward string `json:"reward"`
DateStartAt string `json:"date_start_at"`
DateEndAt string `json:"date_end_at"`
CareType CareType `json:"care_type"`
CarerGender CarerGender `json:"carer_gender"`
RewardAmount RewardAmount `json:"reward_amount"`
ThumbnailID int `json:"thumbnail_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DateStartAt string `json:"dateStartAt"`
DateEndAt string `json:"dateEndAt"`
CareType CareType `json:"careType"`
CarerGender CarerGender `json:"carerGender"`
RewardAmount RewardAmount `json:"rewardAmount"`
ThumbnailID int `json:"thumbnailId"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}

type FindSosPostView struct {
Expand All @@ -51,14 +51,14 @@ type FindSosPostView struct {
Conditions []ConditionView `json:"conditions"`
Pets []pet.PetView `json:"pets"`
Reward string `json:"reward"`
DateStartAt string `json:"date_start_at"`
DateEndAt string `json:"date_end_at"`
CareType CareType `json:"care_type"`
CarerGender CarerGender `json:"carer_gender"`
RewardAmount RewardAmount `json:"reward_amount"`
ThumbnailID int `json:"thumbnail_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DateStartAt string `json:"dateStartAt"`
DateEndAt string `json:"dateEndAt"`
CareType CareType `json:"careType"`
CarerGender CarerGender `json:"carerGender"`
RewardAmount RewardAmount `json:"rewardAmount"`
ThumbnailID int `json:"thumbnailId"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}

type FindSosPostListView struct {
Expand All @@ -77,32 +77,32 @@ type UpdateSosPostRequest struct {
ID int `json:"id" validate:"required"`
Title string `json:"title" validate:"required"`
Content string `json:"content" validate:"required"`
ImageIDs []int `json:"image_ids" validate:"required"`
ImageIDs []int `json:"imageIds" validate:"required"`
Reward string `json:"reward" validate:"required"`
DateStartAt string `json:"date_start_at" validate:"required"`
DateEndAt string `json:"date_end_at" validate:"required"`
CareType CareType `json:"care_type" validate:"required,oneof= foster visiting"`
CarerGender CarerGender `json:"carer_gender" validate:"required,oneof=male female all"`
RewardAmount RewardAmount `json:"reward_amount" validate:"required,oneof=hour"`
ConditionIDs []int `json:"condition_ids"`
PetIDs []int `json:"pet_ids"`
DateStartAt string `json:"dateStartAt" validate:"required"`
DateEndAt string `json:"dateEndAt" validate:"required"`
CareType CareType `json:"careType" validate:"required,oneof= foster visiting"`
CarerGender CarerGender `json:"carerGender" validate:"required,oneof=male female all"`
RewardAmount RewardAmount `json:"rewardAmount" validate:"required,oneof=hour"`
ConditionIDs []int `json:"conditionIds"`
PetIDs []int `json:"petIds"`
}

type UpdateSosPostView struct {
ID int `json:"id"`
AuthorID int `json:"author_id"`
AuthorID int `json:"authorId"`
Title string `json:"title"`
Content string `json:"content"`
Media []media.MediaView `json:"media"`
Conditions []ConditionView `json:"conditions"`
Pets []pet.PetView `json:"pets"`
Reward string `json:"reward"`
DateStartAt string `json:"date_start_at"`
DateEndAt string `json:"date_end_at"`
CareType CareType `json:"care_type"`
CarerGender CarerGender `json:"carer_gender"`
RewardAmount RewardAmount `json:"reward_amount"`
ThumbnailID int `json:"thumbnail_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DateStartAt string `json:"dateStartAt"`
DateEndAt string `json:"dateEndAt"`
CareType CareType `json:"careType"`
CarerGender CarerGender `json:"carerGender"`
RewardAmount RewardAmount `json:"rewardAmount"`
ThumbnailID int `json:"thumbnailId"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}

0 comments on commit 1e7aae3

Please sign in to comment.