All checks were successful
Server CI/CD / deploy (push) Successful in 38s
게임 EXE의 SHA256 해시를 저장하여 런처가 버전 검증에 활용 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
528 B
Go
27 lines
528 B
Go
package download
|
|
|
|
type Service struct {
|
|
repo *Repository
|
|
}
|
|
|
|
func NewService(repo *Repository) *Service {
|
|
return &Service{repo: repo}
|
|
}
|
|
|
|
func (s *Service) GetInfo() (*Info, error) {
|
|
return s.repo.GetLatest()
|
|
}
|
|
|
|
func (s *Service) Upsert(url, version, fileName, fileSize, fileHash string) (*Info, error) {
|
|
info, err := s.repo.GetLatest()
|
|
if err != nil {
|
|
info = &Info{}
|
|
}
|
|
info.URL = url
|
|
info.Version = version
|
|
info.FileName = fileName
|
|
info.FileSize = fileSize
|
|
info.FileHash = fileHash
|
|
return info, s.repo.Save(info)
|
|
}
|