Skip to content

Commit

Permalink
feat: upgrade protos to v0.3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
MuZhou233 committed Feb 14, 2024
1 parent 0a1b1cb commit f745b82
Show file tree
Hide file tree
Showing 23 changed files with 561 additions and 161 deletions.
23 changes: 23 additions & 0 deletions app/sephirah/internal/data/internal/converter/biz_to_ent.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent"
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent/app"
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent/apppackage"
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent/deviceinfo"
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent/feedconfig"
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent/image"
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent/notifyflow"
Expand All @@ -27,6 +28,7 @@ import (
// goverter:extend ToEntAppPackageSource
// goverter:extend ToEntFeedConfigStatus
// goverter:extend ToEntNotifyTargetStatus
// goverter:extend ToEntSystemType
type toEntConverter interface { //nolint:unused // used by generator
ToEntUserTypeList([]libauth.UserType) []user.Type
ToEntUserStatusList([]modeltiphereth.UserStatus) []user.Status
Expand Down Expand Up @@ -160,3 +162,24 @@ func ToEntImageStatus(s modelchesed.ImageStatus) image.Status {
return ""
}
}

func ToEntSystemType(s modeltiphereth.SystemType) deviceinfo.SystemType {
switch s {
case modeltiphereth.SystemTypeUnspecified:
return deviceinfo.SystemTypeUnknown
case modeltiphereth.SystemTypeIOS:
return deviceinfo.SystemTypeIos
case modeltiphereth.SystemTypeAndroid:
return deviceinfo.SystemTypeAndroid
case modeltiphereth.SystemTypeWindows:
return deviceinfo.SystemTypeWindows
case modeltiphereth.SystemTypeMacOS:
return deviceinfo.SystemTypeMacos
case modeltiphereth.SystemTypeLinux:
return deviceinfo.SystemTypeLinux
case modeltiphereth.SystemTypeWeb:
return deviceinfo.SystemTypeWeb
default:
return deviceinfo.SystemTypeUnknown
}
}
24 changes: 24 additions & 0 deletions app/sephirah/internal/data/internal/converter/ent_to_biz.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent"
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent/app"
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent/apppackage"
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent/deviceinfo"
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent/feedconfig"
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent/image"
"github.com/tuihub/librarian/app/sephirah/internal/data/internal/ent/notifyflow"
Expand Down Expand Up @@ -41,6 +42,7 @@ type toBizConverter interface { //nolint:unused // used by generator
ToBizUserSessionList([]*ent.UserSession) []*modeltiphereth.UserSession

// goverter:matchIgnoreCase
// goverter:map SystemType | ToBizSystemType
ToBizDeviceInfo(*ent.DeviceInfo) *modeltiphereth.DeviceInfo

// goverter:matchIgnoreCase
Expand All @@ -50,6 +52,7 @@ type toBizConverter interface { //nolint:unused // used by generator

// goverter:matchIgnoreCase
// goverter:map Status | ToBizPorterStatus
// goverter:ignore ConnectionStatus
ToBizPorter(*ent.PorterInstance) *modeltiphereth.PorterInstance
ToBizPorterList([]*ent.PorterInstance) []*modeltiphereth.PorterInstance

Expand Down Expand Up @@ -210,3 +213,24 @@ func ToBizImageStatus(s image.Status) modelchesed.ImageStatus {
return modelchesed.ImageStatusUnspecified
}
}

func ToBizSystemType(s deviceinfo.SystemType) modeltiphereth.SystemType {
switch s {
case deviceinfo.SystemTypeUnknown:
return modeltiphereth.SystemTypeUnspecified
case deviceinfo.SystemTypeIos:
return modeltiphereth.SystemTypeIOS
case deviceinfo.SystemTypeAndroid:
return modeltiphereth.SystemTypeAndroid
case deviceinfo.SystemTypeWeb:
return modeltiphereth.SystemTypeWeb
case deviceinfo.SystemTypeWindows:
return modeltiphereth.SystemTypeWindows
case deviceinfo.SystemTypeMacos:
return modeltiphereth.SystemTypeMacOS
case deviceinfo.SystemTypeLinux:
return modeltiphereth.SystemTypeLinux
default:
return modeltiphereth.SystemTypeUnspecified
}
}
3 changes: 2 additions & 1 deletion app/sephirah/internal/data/internal/converter/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions app/sephirah/internal/data/internal/ent/deviceinfo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 43 additions & 6 deletions app/sephirah/internal/data/internal/ent/deviceinfo/deviceinfo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 62 additions & 42 deletions app/sephirah/internal/data/internal/ent/deviceinfo/where.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f745b82

Please sign in to comment.