Sub2API v1.0 - AI API 网关(二开初始版本,基于上游 Wei-Shaw/sub2api)
Release / update-version (push) Has been cancelled
Release / build-frontend (push) Has been cancelled
Release / release (push) Has been cancelled
Release / sync-version-file (push) Has been cancelled
CI / shell (push) Canceled after 0s
CI / test (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / golangci-lint (push) Canceled after 0s
Security Scan / backend-security (push) Canceled after 0s
Security Scan / frontend-security (push) Canceled after 0s
Release / update-version (push) Has been cancelled
Release / build-frontend (push) Has been cancelled
Release / release (push) Has been cancelled
Release / sync-version-file (push) Has been cancelled
CI / shell (push) Canceled after 0s
CI / test (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / golangci-lint (push) Canceled after 0s
Security Scan / backend-security (push) Canceled after 0s
Security Scan / frontend-security (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package dto
|
||||
|
||||
import "github.com/Wei-Shaw/sub2api/internal/service"
|
||||
|
||||
// NotifyEmailEntry represents a notification email with enable/disable and verification state.
|
||||
// All emails are user-managed; maximum 3 entries per user.
|
||||
type NotifyEmailEntry struct {
|
||||
Email string `json:"email"`
|
||||
Disabled bool `json:"disabled"`
|
||||
Verified bool `json:"verified"`
|
||||
}
|
||||
|
||||
// NotifyEmailEntriesFromService converts service entries to DTO entries.
|
||||
func NotifyEmailEntriesFromService(entries []service.NotifyEmailEntry) []NotifyEmailEntry {
|
||||
if entries == nil {
|
||||
return nil
|
||||
}
|
||||
result := make([]NotifyEmailEntry, len(entries))
|
||||
for i, e := range entries {
|
||||
result[i] = NotifyEmailEntry{
|
||||
Email: e.Email,
|
||||
Disabled: e.Disabled,
|
||||
Verified: e.Verified,
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// NotifyEmailEntriesToService converts DTO entries to service entries.
|
||||
func NotifyEmailEntriesToService(entries []NotifyEmailEntry) []service.NotifyEmailEntry {
|
||||
if entries == nil {
|
||||
return nil
|
||||
}
|
||||
result := make([]service.NotifyEmailEntry, len(entries))
|
||||
for i, e := range entries {
|
||||
result[i] = service.NotifyEmailEntry{
|
||||
Email: e.Email,
|
||||
Disabled: e.Disabled,
|
||||
Verified: e.Verified,
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user