Skip to content

Commit

Permalink
chore: add json tag keyname
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelact committed Jun 22, 2022
1 parent 4e0b964 commit 3021903
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
20 changes: 10 additions & 10 deletions model/web/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import (
)

type ActivityCreateRequest struct {
Email string `validate:"required,max=30"`
Title string `validate:"required,max=30"`
Email string `validate:"required,max=30" json:"email"`
Title string `validate:"required,max=30" json:"title"`
}

type ActivityUpdateRequest struct {
Id int `validate:"required"`
Email string `validate:"required,max=30"`
Title string `validate:"required,max=30"`
Email string `validate:"required,max=30" json:"email"`
Title string `validate:"required,max=30" json:"title"`
}

type ActivityResponse struct {
Id int
Email string
Title string
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt time.Time
Id int `json:"id"`
Email string `json:"email"`
Title string `json:"title"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
}
22 changes: 11 additions & 11 deletions model/web/todo.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ import (

type TodoCreateRequest struct {
ActivityGroupId int `validate:"required"`
Title string `validate:"required,max=30"`
Title string `validate:"required,max=30" json:"title"`
}

type TodoUpdateRequest struct {
Id int `validate:"required"`
ActivityGroupId int `validate:"required"`
Title string `validate:"required,max=30"`
ActivityGroupId int `validate:"required" json:"activity_group_id"`
Title string `validate:"required,max=30" json:"title"`
}

type TodoResponse struct {
Id int
ActivityGroupId int
Title string
IsActive bool
Priority string
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt time.Time
Id int `json:"id"`
ActivityGroupId int `json:"activity_group_id"`
Title string `json:"title"`
IsActive bool `json:"is_active"`
Priority string `json:"priority"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
}
4 changes: 2 additions & 2 deletions model/web/web.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package web

type WebResponse struct {
Status string
Message string
Status string `json:"status"`
Message string `json:"message"`
Data interface{}
}

0 comments on commit 3021903

Please sign in to comment.