Skip to content

Commit

Permalink
Merge pull request #518 from sangkenlee/latest-version-bugfix
Browse files Browse the repository at this point in the history
Latest version bugfix
  • Loading branch information
ktkfree authored Jun 18, 2024
2 parents 73dd7be + 9858b5a commit daa6db6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/repository/policy-template.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (r *PolicyTemplateRepository) FetchForOrganization(ctx context.Context, org
_, res := pg.Fetch(r.db.WithContext(ctx).
Preload("SupportedVersions", func(db *gorm.DB) *gorm.DB {
// 최신 버전만
return db.Order("policy_template_supported_versions.version DESC")
return db.Order("policy_template_supported_versions.created_at DESC")
}).
Preload("Creator").Preload("Updator"). // organization을 기준으로 조회할 때에는 PermittedOrganizations는 로딩하지 않아도 됨
Model(&model.PolicyTemplate{}).
Expand Down Expand Up @@ -274,7 +274,7 @@ func (r *PolicyTemplateRepository) GetBy(ctx context.Context, key string, value
res := r.db.WithContext(ctx).
Preload("SupportedVersions", func(db *gorm.DB) *gorm.DB {
// 최신 버전만
return db.Order("policy_template_supported_versions.version DESC").Limit(1)
return db.Order("policy_template_supported_versions.created_at DESC").Limit(1)
}).
Preload("PermittedOrganizations").Preload("Creator").Preload("Updator").
Where(query, value).
Expand Down

0 comments on commit daa6db6

Please sign in to comment.