Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
moyomogi committed Oct 9, 2023
1 parent 007143c commit a4c55aa
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions domain/domain_article.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
// https://zenn.dev/skanehira/articles/2020-09-19-go-echo-bind-tips
type Article struct {
ID uuid.UUID `gorm:"type:char(36);primary_key;not null" param:"id" json:"id"`
CreatedAt time.Time `gorm:"type:char(6)" json:"created_at"`
UpdatedAt time.Time `gorm:"type:char(6)" json:"updated_at"`
CreatedAt time.Time
UpdatedAt time.Time
EventId string `gorm:"type:char(36);not null" validate:"required" json:"event_id"`
Title string `gorm:"type:text" validate:"required" json:"title"`
Body string `gorm:"type:text" validate:"required" json:"body"`
Expand Down
4 changes: 2 additions & 2 deletions domain/domain_article_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

type ArticleComment struct {
ID uuid.UUID `gorm:"type:char(36);primaryKey;not null" json:"id"`
CreatedAt time.Time `gorm:"type:char(6)" json:"created_at"`
UpdatedAt time.Time `gorm:"type:char(6)" json:"updated_at"`
CreatedAt time.Time
UpdatedAt time.Time
ArticleID uuid.UUID `gorm:"type:char(36);not null" json:"article_id"`
Body string `gorm:"type:text" validate:"required" json:"body"`
Rate int `validate:"required,gte=1,lte=5" json:"rate"` // 1-5
Expand Down
4 changes: 2 additions & 2 deletions domain/domain_article_game_content.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
type ArticleGameContent struct {
// ArticleID
ID uuid.UUID `gorm:"type:char(36);primaryKey;not null" json:"id"`
CreatedAt time.Time `gorm:"type:char(6)" json:"created_at"`
UpdatedAt time.Time `gorm:"type:char(6)" json:"updated_at"`
CreatedAt time.Time
UpdatedAt time.Time
ExecPath string `gorm:"type:text" validate:"required" json:"exec_path"`
ZipURL string `gorm:"type:text" validate:"required" json:"zip_url"`
}
Expand Down
5 changes: 2 additions & 3 deletions domain/domain_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import (

type User struct {
ID uuid.UUID `gorm:"type:char(36);primary_key;not null" json:"id"`
CreatedAt time.Time `gorm:"type:char(6)" json:"created_at"`
UpdatedAt time.Time `gorm:"type:char(6)" json:"updated_at"`
GoogleID string `gorm:"type:char(28);not null" json:"google_id"`
CreatedAt time.Time
UpdatedAt time.Time
Role string `gorm:"type:text" validate:"required" json:"role"`
Name string `gorm:"type:text" validate:"required" json:"name"`
}
Expand Down
19 changes: 10 additions & 9 deletions migration/version/v20230830.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package version

import (
"gorm.io/gorm"
"time"

"gorm.io/gorm"

"github.com/ch-random/random-launcher-backend/domain"
"github.com/google/uuid"
)
Expand All @@ -17,8 +18,8 @@ func (*v20230830ArticleNewColumn) TableName() string {

type v20230830ArticleComment struct {
ID uuid.UUID `gorm:"type:char(36);primaryKey;not null" json:"id"`
CreatedAt time.Time `gorm:"type:char(6)" json:"created_at"`
UpdatedAt time.Time `gorm:"type:char(6)" json:"updated_at"`
CreatedAt time.Time
UpdatedAt time.Time
ArticleID uuid.UUID `gorm:"type:char(36);not null" json:"article_id"`
Body string `gorm:"type:text" validate:"required" json:"body"`
Rate int `validate:"required,gte=1,lte=5" json:"rate"` // 1-5
Expand All @@ -30,8 +31,8 @@ func (*v20230830ArticleComment) TableName() string {
type v20230830ArticleGameContent struct {
// ArticleID
ID uuid.UUID `gorm:"type:char(36);primaryKey;not null" json:"id"`
CreatedAt time.Time `gorm:"type:char(6)" json:"created_at"`
UpdatedAt time.Time `gorm:"type:char(6)" json:"updated_at"`
CreatedAt time.Time
UpdatedAt time.Time
ExecPath string `gorm:"type:text" validate:"required" json:"exec_path"`
ZipURL string `gorm:"type:text" validate:"required" json:"zip_url"`
}
Expand Down Expand Up @@ -71,8 +72,8 @@ func (*v20230830ArticleTag) TableName() string {

type v20230830Article struct {
ID uuid.UUID `gorm:"type:char(36);primary_key;not null" param:"id" json:"id"`
CreatedAt time.Time `gorm:"type:char(6)" json:"created_at"`
UpdatedAt time.Time `gorm:"type:char(6)" json:"updated_at"`
CreatedAt time.Time
UpdatedAt time.Time
EventId string `gorm:"type:char(36);not null" validate:"required" json:"event_id"`
Title string `gorm:"type:text" validate:"required" json:"title"`
Body string `gorm:"type:text" validate:"required" json:"body"`
Expand All @@ -94,8 +95,8 @@ func (*v20230830Article) TableName() string {

type v20230830User struct {
ID uuid.UUID `gorm:"type:char(36);primary_key;not null" json:"id"`
CreatedAt time.Time `gorm:"type:char(6)" json:"created_at"`
UpdatedAt time.Time `gorm:"type:char(6)" json:"updated_at"`
CreatedAt time.Time
UpdatedAt time.Time
GoogleID string `gorm:"type:char(28);not null" json:"google_id"`
Role string `gorm:"type:text" validate:"required" json:"role"`
Name string `gorm:"type:text" validate:"required" json:"name"`
Expand Down
6 changes: 3 additions & 3 deletions repository/pscale/pscale_article.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ func (articleRepo *pscaleArticleRepository) Fetch(cursor string, numString strin
}
log.Printf("ars: %v", ars)

if len(ars) > 0 && len(ars) == num {
nextCursor = repository.EncodeCursor(ars[len(ars)-1].CreatedAt)
}
// if len(ars) > 0 && len(ars) == num {
// nextCursor = repository.EncodeCursor(ars[len(ars)-1].CreatedAt)
// }
return
}

Expand Down
6 changes: 3 additions & 3 deletions repository/pscale/pscale_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ func (userRepo *pscaleUserRepository) Fetch(cursor string, numString string) (us
}
log.Printf("us: %v", us)

if len(us) > 0 && len(us) == num {
nextCursor = repository.EncodeCursor(us[len(us)-1].CreatedAt)
}
// if len(us) > 0 && len(us) == num {
// nextCursor = repository.EncodeCursor(us[len(us)-1].CreatedAt)
// }
return
}

Expand Down
2 changes: 1 addition & 1 deletion usecase/usecase_article.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (au *articleUsecase) Update(c context.Context, ar *domain.Article) error {
_, cancel := context.WithTimeout(c, au.timeout)
defer cancel()

ar.UpdatedAt = time.Now()
// ar.UpdatedAt = time.Now()
return au.ar.Update(ar)
}

Expand Down
2 changes: 1 addition & 1 deletion usecase/usecase_article_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (acu *articleCommentUsecase) Update(c context.Context, ac *domain.ArticleCo
_, cancel := context.WithTimeout(c, acu.timeout)
defer cancel()

ac.UpdatedAt = time.Now()
// ac.UpdatedAt = time.Now()
return acu.acr.Update(ac)
}

Expand Down
6 changes: 3 additions & 3 deletions usecase/usecase_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func fillNewUserDetails(u *domain.User) (*domain.User, error) {
uid := uuid.New()
log.Printf("uid: %v", uid)
u.ID = uid
u.CreatedAt = time.Now()
u.UpdatedAt = time.Now()
// u.CreatedAt = time.Now()
// u.UpdatedAt = time.Now()
return u, nil
}
func (uu *userUsecase) Insert(c context.Context, u *domain.User) (err error) {
Expand Down Expand Up @@ -80,6 +80,6 @@ func (uu *userUsecase) Update(c context.Context, ac *domain.User) error {
_, cancel := context.WithTimeout(c, uu.timeout)
defer cancel()

ac.UpdatedAt = time.Now()
// ac.UpdatedAt = time.Now()
return uu.ur.Update(ac)
}

0 comments on commit a4c55aa

Please sign in to comment.