Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
0b746501
Commit
0b746501
authored
Apr 16, 2026
by
陈曦
Browse files
1. merge upstream v0.1.113 2.提交migration相关文件
parents
45061102
be7551b9
Changes
225
Expand all
Hide whitespace changes
Inline
Side-by-side
.github/workflows/backend-ci.yml
View file @
0b746501
...
...
@@ -17,6 +17,7 @@ jobs:
go-version-file
:
backend/go.mod
check-latest
:
false
cache
:
true
cache-dependency-path
:
backend/go.sum
-
name
:
Verify Go version
run
:
|
go version | grep -q 'go1.26.2'
...
...
@@ -36,6 +37,7 @@ jobs:
go-version-file
:
backend/go.mod
check-latest
:
false
cache
:
true
cache-dependency-path
:
backend/go.sum
-
name
:
Verify Go version
run
:
|
go version | grep -q 'go1.26.2'
...
...
Antigravity-Manager
@
a9d96bd5
Subproject commit a9d96bd54978c22d3033830debfe77aeeeee2500
backend/cmd/server/VERSION
View file @
0b746501
0.1.11
2
0.1.11
3
backend/cmd/server/wire.go
View file @
0b746501
...
...
@@ -36,19 +36,13 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
// Business layer ProviderSets
repository
.
ProviderSet
,
service
.
ProviderSet
,
payment
.
ProviderSet
,
middleware
.
ProviderSet
,
handler
.
ProviderSet
,
// Server layer ProviderSet
server
.
ProviderSet
,
// Payment providers
payment
.
ProvideRegistry
,
payment
.
ProvideEncryptionKey
,
payment
.
ProvideDefaultLoadBalancer
,
service
.
ProvidePaymentConfigService
,
service
.
ProvidePaymentOrderExpiryService
,
// Privacy client factory for OpenAI training opt-out
providePrivacyClientFactory
,
...
...
backend/cmd/server/wire_gen.go
View file @
0b746501
...
...
@@ -50,8 +50,8 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
refreshTokenCache
:=
repository
.
NewRefreshTokenCache
(
redisClient
)
settingRepository
:=
repository
.
NewSettingRepository
(
client
)
groupRepository
:=
repository
.
NewGroupRepository
(
client
,
db
)
channel
Repository
:=
repository
.
New
Channel
Repository
(
db
)
settingService
:=
service
.
ProvideSettingService
(
settingRepository
,
groupRepository
,
configConfig
)
proxy
Repository
:=
repository
.
New
Proxy
Repository
(
client
,
db
)
settingService
:=
service
.
ProvideSettingService
(
settingRepository
,
groupRepository
,
proxyRepository
,
configConfig
)
emailCache
:=
repository
.
NewEmailCache
(
redisClient
)
emailService
:=
service
.
NewEmailService
(
settingRepository
,
emailCache
)
turnstileVerifier
:=
repository
.
NewTurnstileVerifier
()
...
...
@@ -65,23 +65,13 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
userGroupRateRepository
:=
repository
.
NewUserGroupRateRepository
(
db
)
apiKeyCache
:=
repository
.
NewAPIKeyCache
(
redisClient
)
apiKeyService
:=
service
.
NewAPIKeyService
(
apiKeyRepository
,
userRepository
,
groupRepository
,
userSubscriptionRepository
,
userGroupRateRepository
,
apiKeyCache
,
configConfig
)
apiKeyService
.
SetRateLimitCacheInvalidator
(
billingCache
)
apiKeyAuthCacheInvalidator
:=
service
.
ProvideAPIKeyAuthCacheInvalidator
(
apiKeyService
)
promoService
:=
service
.
NewPromoService
(
promoCodeRepository
,
userRepository
,
billingCacheService
,
client
,
apiKeyAuthCacheInvalidator
)
subscriptionService
:=
service
.
NewSubscriptionService
(
groupRepository
,
userSubscriptionRepository
,
billingCacheService
,
client
,
configConfig
)
authService
:=
service
.
NewAuthService
(
client
,
userRepository
,
redeemCodeRepository
,
refreshTokenCache
,
configConfig
,
settingService
,
emailService
,
turnstileService
,
emailQueueService
,
promoService
,
subscriptionService
)
userService
:=
service
.
NewUserService
(
userRepository
,
apiKeyAuthCacheInvalidator
,
billingCache
)
userService
:=
service
.
NewUserService
(
userRepository
,
settingRepository
,
apiKeyAuthCacheInvalidator
,
billingCache
)
redeemCache
:=
repository
.
NewRedeemCache
(
redisClient
)
redeemService
:=
service
.
NewRedeemService
(
redeemCodeRepository
,
userRepository
,
subscriptionService
,
redeemCache
,
billingCacheService
,
client
,
apiKeyAuthCacheInvalidator
)
registry
:=
payment
.
ProvideRegistry
()
encryptionKey
,
err
:=
payment
.
ProvideEncryptionKey
(
configConfig
)
if
err
!=
nil
{
return
nil
,
err
}
defaultLoadBalancer
:=
payment
.
ProvideDefaultLoadBalancer
(
client
,
encryptionKey
)
paymentConfigService
:=
service
.
ProvidePaymentConfigService
(
client
,
settingRepository
,
encryptionKey
)
paymentService
:=
service
.
NewPaymentService
(
client
,
registry
,
defaultLoadBalancer
,
redeemService
,
subscriptionService
,
paymentConfigService
,
userRepository
,
groupRepository
)
paymentOrderExpiryService
:=
service
.
ProvidePaymentOrderExpiryService
(
paymentService
)
secretEncryptor
,
err
:=
repository
.
NewAESEncryptor
(
configConfig
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -89,10 +79,9 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
totpCache
:=
repository
.
NewTotpCache
(
redisClient
)
totpService
:=
service
.
NewTotpService
(
userRepository
,
secretEncryptor
,
totpCache
,
settingService
,
emailService
,
emailQueueService
)
authHandler
:=
handler
.
NewAuthHandler
(
configConfig
,
authService
,
userService
,
settingService
,
promoService
,
redeemService
,
totpService
)
userHandler
:=
handler
.
NewUserHandler
(
userService
)
userHandler
:=
handler
.
NewUserHandler
(
userService
,
emailService
,
emailCache
)
apiKeyHandler
:=
handler
.
NewAPIKeyHandler
(
apiKeyService
)
usageLogRepository
:=
repository
.
NewUsageLogRepository
(
client
,
db
)
usageBillingRepository
:=
repository
.
NewUsageBillingRepository
(
client
,
db
)
usageService
:=
service
.
NewUsageService
(
usageLogRepository
,
userRepository
,
client
,
apiKeyAuthCacheInvalidator
)
usageHandler
:=
handler
.
NewUsageHandler
(
usageService
,
apiKeyService
)
redeemHandler
:=
handler
.
NewRedeemHandler
(
redeemService
)
...
...
@@ -112,7 +101,6 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
dashboardHandler
:=
admin
.
NewDashboardHandler
(
dashboardService
,
dashboardAggregationService
)
schedulerCache
:=
repository
.
ProvideSchedulerCache
(
redisClient
,
configConfig
)
accountRepository
:=
repository
.
NewAccountRepository
(
client
,
db
,
schedulerCache
)
proxyRepository
:=
repository
.
NewProxyRepository
(
client
,
db
)
proxyExitInfoProber
:=
repository
.
NewProxyExitInfoProber
(
configConfig
)
proxyLatencyCache
:=
repository
.
NewProxyLatencyCache
(
redisClient
)
privacyClientFactory
:=
providePrivacyClientFactory
()
...
...
@@ -120,11 +108,14 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
concurrencyCache
:=
repository
.
ProvideConcurrencyCache
(
redisClient
,
configConfig
)
concurrencyService
:=
service
.
ProvideConcurrencyService
(
concurrencyCache
,
accountRepository
,
configConfig
)
adminUserHandler
:=
admin
.
NewUserHandler
(
adminService
,
concurrencyService
)
sessionLimitCache
:=
repository
.
ProvideSessionLimitCache
(
redisClient
,
configConfig
)
rpmCache
:=
repository
.
NewRPMCache
(
redisClient
)
groupCapacityService
:=
service
.
NewGroupCapacityService
(
accountRepository
,
groupRepository
,
concurrencyService
,
sessionLimitCache
,
rpmCache
)
groupHandler
:=
admin
.
NewGroupHandler
(
adminService
,
dashboardService
,
groupCapacityService
)
claudeOAuthClient
:=
repository
.
NewClaudeOAuthClient
()
oAuthService
:=
service
.
NewOAuthService
(
proxyRepository
,
claudeOAuthClient
)
openAIOAuthClient
:=
repository
.
NewOpenAIOAuthClient
()
openAIOAuthService
:=
service
.
NewOpenAIOAuthService
(
proxyRepository
,
openAIOAuthClient
)
openAIOAuthService
.
SetPrivacyClientFactory
(
privacyClientFactory
)
geminiOAuthClient
:=
repository
.
NewGeminiOAuthClient
(
configConfig
)
geminiCliCodeAssistClient
:=
repository
.
NewGeminiCliCodeAssistClient
()
driveClient
:=
repository
.
NewGeminiDriveClient
()
...
...
@@ -134,7 +125,6 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
tempUnschedCache
:=
repository
.
NewTempUnschedCache
(
redisClient
)
timeoutCounterCache
:=
repository
.
NewTimeoutCounterCache
(
redisClient
)
geminiTokenCache
:=
repository
.
NewGeminiTokenCache
(
redisClient
)
oauthRefreshAPI
:=
service
.
NewOAuthRefreshAPI
(
accountRepository
,
geminiTokenCache
)
compositeTokenCacheInvalidator
:=
service
.
NewCompositeTokenCacheInvalidator
(
geminiTokenCache
)
rateLimitService
:=
service
.
ProvideRateLimitService
(
accountRepository
,
usageLogRepository
,
configConfig
,
geminiQuotaService
,
tempUnschedCache
,
timeoutCounterCache
,
settingService
,
compositeTokenCacheInvalidator
)
httpUpstream
:=
repository
.
NewHTTPUpstream
(
configConfig
)
...
...
@@ -142,23 +132,20 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
antigravityQuotaFetcher
:=
service
.
NewAntigravityQuotaFetcher
(
proxyRepository
)
usageCache
:=
service
.
NewUsageCache
()
identityCache
:=
repository
.
NewIdentityCache
(
redisClient
)
geminiTokenProvider
:=
service
.
ProvideGeminiTokenProvider
(
accountRepository
,
geminiTokenCache
,
geminiOAuthService
,
oauthRefreshAPI
)
gatewayCache
:=
repository
.
NewGatewayCache
(
redisClient
)
schedulerOutboxRepository
:=
repository
.
NewSchedulerOutboxRepository
(
db
)
schedulerSnapshotService
:=
service
.
ProvideSchedulerSnapshotService
(
schedulerCache
,
schedulerOutboxRepository
,
accountRepository
,
groupRepository
,
configConfig
)
antigravityTokenProvider
:=
service
.
ProvideAntigravityTokenProvider
(
accountRepository
,
geminiTokenCache
,
antigravityOAuthService
,
oauthRefreshAPI
,
tempUnschedCache
)
internal500CounterCache
:=
repository
.
NewInternal500CounterCache
(
redisClient
)
tlsFingerprintProfileRepository
:=
repository
.
NewTLSFingerprintProfileRepository
(
client
)
tlsFingerprintProfileCache
:=
repository
.
NewTLSFingerprintProfileCache
(
redisClient
)
tlsFingerprintProfileService
:=
service
.
NewTLSFingerprintProfileService
(
tlsFingerprintProfileRepository
,
tlsFingerprintProfileCache
)
accountUsageService
:=
service
.
NewAccountUsageService
(
accountRepository
,
usageLogRepository
,
claudeUsageFetcher
,
geminiQuotaService
,
antigravityQuotaFetcher
,
usageCache
,
identityCache
,
tlsFingerprintProfileService
)
oAuthRefreshAPI
:=
service
.
NewOAuthRefreshAPI
(
accountRepository
,
geminiTokenCache
)
geminiTokenProvider
:=
service
.
ProvideGeminiTokenProvider
(
accountRepository
,
geminiTokenCache
,
geminiOAuthService
,
oAuthRefreshAPI
)
gatewayCache
:=
repository
.
NewGatewayCache
(
redisClient
)
schedulerOutboxRepository
:=
repository
.
NewSchedulerOutboxRepository
(
db
)
schedulerSnapshotService
:=
service
.
ProvideSchedulerSnapshotService
(
schedulerCache
,
schedulerOutboxRepository
,
accountRepository
,
groupRepository
,
configConfig
)
antigravityTokenProvider
:=
service
.
ProvideAntigravityTokenProvider
(
accountRepository
,
geminiTokenCache
,
antigravityOAuthService
,
oAuthRefreshAPI
,
tempUnschedCache
)
internal500CounterCache
:=
repository
.
NewInternal500CounterCache
(
redisClient
)
antigravityGatewayService
:=
service
.
NewAntigravityGatewayService
(
accountRepository
,
gatewayCache
,
schedulerSnapshotService
,
antigravityTokenProvider
,
rateLimitService
,
httpUpstream
,
settingService
,
internal500CounterCache
)
accountTestService
:=
service
.
NewAccountTestService
(
accountRepository
,
geminiTokenProvider
,
antigravityGatewayService
,
httpUpstream
,
configConfig
,
tlsFingerprintProfileService
)
crsSyncService
:=
service
.
NewCRSSyncService
(
accountRepository
,
proxyRepository
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
,
configConfig
)
sessionLimitCache
:=
repository
.
ProvideSessionLimitCache
(
redisClient
,
configConfig
)
rpmCache
:=
repository
.
NewRPMCache
(
redisClient
)
groupCapacityService
:=
service
.
NewGroupCapacityService
(
accountRepository
,
groupRepository
,
concurrencyService
,
sessionLimitCache
,
rpmCache
)
groupHandler
:=
admin
.
NewGroupHandler
(
adminService
,
dashboardService
,
groupCapacityService
)
accountHandler
:=
admin
.
NewAccountHandler
(
adminService
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
,
antigravityOAuthService
,
rateLimitService
,
accountUsageService
,
accountTestService
,
concurrencyService
,
crsSyncService
,
sessionLimitCache
,
rpmCache
,
compositeTokenCacheInvalidator
)
adminAnnouncementHandler
:=
admin
.
NewAnnouncementHandler
(
announcementService
)
dataManagementService
:=
service
.
NewDataManagementService
()
...
...
@@ -175,6 +162,7 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
adminRedeemHandler
:=
admin
.
NewRedeemHandler
(
adminService
,
redeemService
)
promoHandler
:=
admin
.
NewPromoHandler
(
promoService
)
opsRepository
:=
repository
.
NewOpsRepository
(
db
)
usageBillingRepository
:=
repository
.
NewUsageBillingRepository
(
client
,
db
)
pricingRemoteClient
:=
repository
.
ProvidePricingRemoteClient
(
configConfig
)
pricingService
,
err
:=
service
.
ProvidePricingService
(
configConfig
,
pricingRemoteClient
)
if
err
!=
nil
{
...
...
@@ -183,17 +171,18 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
billingService
:=
service
.
NewBillingService
(
configConfig
,
pricingService
)
identityService
:=
service
.
NewIdentityService
(
identityCache
)
deferredService
:=
service
.
ProvideDeferredService
(
accountRepository
,
timingWheelService
)
claudeTokenProvider
:=
service
.
ProvideClaudeTokenProvider
(
accountRepository
,
geminiTokenCache
,
oAuthService
,
o
a
uthRefreshAPI
)
claudeTokenProvider
:=
service
.
ProvideClaudeTokenProvider
(
accountRepository
,
geminiTokenCache
,
oAuthService
,
o
A
uthRefreshAPI
)
digestSessionStore
:=
service
.
NewDigestSessionStore
()
channelRepository
:=
repository
.
NewChannelRepository
(
db
)
channelService
:=
service
.
NewChannelService
(
channelRepository
,
apiKeyAuthCacheInvalidator
)
modelPricingResolver
:=
service
.
NewModelPricingResolver
(
channelService
,
billingService
)
gatewayService
:=
service
.
NewGatewayService
(
accountRepository
,
groupRepository
,
usageLogRepository
,
usageBillingRepository
,
userRepository
,
userSubscriptionRepository
,
userGroupRateRepository
,
gatewayCache
,
configConfig
,
schedulerSnapshotService
,
concurrencyService
,
billingService
,
rateLimitService
,
billingCacheService
,
identityService
,
httpUpstream
,
deferredService
,
claudeTokenProvider
,
sessionLimitCache
,
rpmCache
,
digestSessionStore
,
settingService
,
tlsFingerprintProfileService
,
channelService
,
modelPricingResolver
)
openAITokenProvider
:=
service
.
ProvideOpenAITokenProvider
(
accountRepository
,
geminiTokenCache
,
openAIOAuthService
,
oauthRefreshAPI
)
openAIGatewayService
:=
service
.
NewOpenAIGatewayService
(
accountRepository
,
usageLogRepository
,
usageBillingRepository
,
userRepository
,
userSubscriptionRepository
,
userGroupRateRepository
,
gatewayCache
,
configConfig
,
schedulerSnapshotService
,
concurrencyService
,
billingService
,
rateLimitService
,
billingCacheService
,
httpUpstream
,
deferredService
,
openAITokenProvider
,
modelPricingResolver
,
channelService
)
balanceNotifyService
:=
service
.
ProvideBalanceNotifyService
(
emailService
,
settingRepository
,
accountRepository
)
gatewayService
:=
service
.
NewGatewayService
(
accountRepository
,
groupRepository
,
usageLogRepository
,
usageBillingRepository
,
userRepository
,
userSubscriptionRepository
,
userGroupRateRepository
,
gatewayCache
,
configConfig
,
schedulerSnapshotService
,
concurrencyService
,
billingService
,
rateLimitService
,
billingCacheService
,
identityService
,
httpUpstream
,
deferredService
,
claudeTokenProvider
,
sessionLimitCache
,
rpmCache
,
digestSessionStore
,
settingService
,
tlsFingerprintProfileService
,
channelService
,
modelPricingResolver
,
balanceNotifyService
)
openAITokenProvider
:=
service
.
ProvideOpenAITokenProvider
(
accountRepository
,
geminiTokenCache
,
openAIOAuthService
,
oAuthRefreshAPI
)
openAIGatewayService
:=
service
.
NewOpenAIGatewayService
(
accountRepository
,
usageLogRepository
,
usageBillingRepository
,
userRepository
,
userSubscriptionRepository
,
userGroupRateRepository
,
gatewayCache
,
configConfig
,
schedulerSnapshotService
,
concurrencyService
,
billingService
,
rateLimitService
,
billingCacheService
,
httpUpstream
,
deferredService
,
openAITokenProvider
,
modelPricingResolver
,
channelService
,
balanceNotifyService
)
geminiMessagesCompatService
:=
service
.
NewGeminiMessagesCompatService
(
accountRepository
,
groupRepository
,
gatewayCache
,
schedulerSnapshotService
,
geminiTokenProvider
,
rateLimitService
,
httpUpstream
,
antigravityGatewayService
,
configConfig
)
opsSystemLogSink
:=
service
.
ProvideOpsSystemLogSink
(
opsRepository
)
opsService
:=
service
.
NewOpsService
(
opsRepository
,
settingRepository
,
configConfig
,
accountRepository
,
userRepository
,
concurrencyService
,
gatewayService
,
openAIGatewayService
,
geminiMessagesCompatService
,
antigravityGatewayService
,
opsSystemLogSink
)
settingHandler
:=
admin
.
NewSettingHandler
(
settingService
,
emailService
,
turnstileService
,
opsService
,
paymentConfigService
,
paymentService
)
opsHandler
:=
admin
.
NewOpsHandler
(
opsService
)
updateCache
:=
repository
.
NewUpdateCache
(
redisClient
)
gitHubReleaseClient
:=
repository
.
ProvideGitHubReleaseClient
(
configConfig
)
...
...
@@ -221,8 +210,18 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
scheduledTestService
:=
service
.
ProvideScheduledTestService
(
scheduledTestPlanRepository
,
scheduledTestResultRepository
)
scheduledTestHandler
:=
admin
.
NewScheduledTestHandler
(
scheduledTestService
)
channelHandler
:=
admin
.
NewChannelHandler
(
channelService
,
billingService
)
adminPaymentHandler
:=
admin
.
NewPaymentHandler
(
paymentService
,
paymentConfigService
)
adminHandlers
:=
handler
.
ProvideAdminHandlers
(
dashboardHandler
,
adminUserHandler
,
groupHandler
,
accountHandler
,
adminAnnouncementHandler
,
dataManagementHandler
,
backupHandler
,
oAuthHandler
,
openAIOAuthHandler
,
geminiOAuthHandler
,
antigravityOAuthHandler
,
proxyHandler
,
adminRedeemHandler
,
promoHandler
,
settingHandler
,
opsHandler
,
systemHandler
,
adminSubscriptionHandler
,
adminUsageHandler
,
userAttributeHandler
,
errorPassthroughHandler
,
tlsFingerprintProfileHandler
,
adminAPIKeyHandler
,
scheduledTestHandler
,
channelHandler
,
adminPaymentHandler
)
registry
:=
payment
.
ProvideRegistry
()
encryptionKey
,
err
:=
payment
.
ProvideEncryptionKey
(
configConfig
)
if
err
!=
nil
{
return
nil
,
err
}
defaultLoadBalancer
:=
payment
.
ProvideDefaultLoadBalancer
(
client
,
encryptionKey
)
paymentConfigService
:=
service
.
ProvidePaymentConfigService
(
client
,
settingRepository
,
encryptionKey
)
paymentService
:=
service
.
NewPaymentService
(
client
,
registry
,
defaultLoadBalancer
,
redeemService
,
subscriptionService
,
paymentConfigService
,
userRepository
,
groupRepository
)
settingHandler
:=
admin
.
NewSettingHandler
(
settingService
,
emailService
,
turnstileService
,
opsService
,
paymentConfigService
,
paymentService
)
paymentOrderExpiryService
:=
service
.
ProvidePaymentOrderExpiryService
(
paymentService
)
paymentHandler
:=
admin
.
NewPaymentHandler
(
paymentService
,
paymentConfigService
)
adminHandlers
:=
handler
.
ProvideAdminHandlers
(
dashboardHandler
,
adminUserHandler
,
groupHandler
,
accountHandler
,
adminAnnouncementHandler
,
dataManagementHandler
,
backupHandler
,
oAuthHandler
,
openAIOAuthHandler
,
geminiOAuthHandler
,
antigravityOAuthHandler
,
proxyHandler
,
adminRedeemHandler
,
promoHandler
,
settingHandler
,
opsHandler
,
systemHandler
,
adminSubscriptionHandler
,
adminUsageHandler
,
userAttributeHandler
,
errorPassthroughHandler
,
tlsFingerprintProfileHandler
,
adminAPIKeyHandler
,
scheduledTestHandler
,
channelHandler
,
paymentHandler
)
usageRecordWorkerPool
:=
service
.
NewUsageRecordWorkerPool
(
configConfig
)
userMsgQueueCache
:=
repository
.
NewUserMsgQueueCache
(
redisClient
)
userMessageQueueService
:=
service
.
ProvideUserMessageQueueService
(
userMsgQueueCache
,
rpmCache
,
configConfig
)
...
...
@@ -245,7 +244,7 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
opsAlertEvaluatorService
:=
service
.
ProvideOpsAlertEvaluatorService
(
opsService
,
opsRepository
,
emailService
,
redisClient
,
configConfig
)
opsCleanupService
:=
service
.
ProvideOpsCleanupService
(
opsRepository
,
db
,
redisClient
,
configConfig
)
opsScheduledReportService
:=
service
.
ProvideOpsScheduledReportService
(
opsService
,
userService
,
emailService
,
redisClient
,
configConfig
)
tokenRefreshService
:=
service
.
ProvideTokenRefreshService
(
accountRepository
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
,
antigravityOAuthService
,
compositeTokenCacheInvalidator
,
schedulerCache
,
configConfig
,
tempUnschedCache
,
privacyClientFactory
,
proxyRepository
,
o
a
uthRefreshAPI
)
tokenRefreshService
:=
service
.
ProvideTokenRefreshService
(
accountRepository
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
,
antigravityOAuthService
,
compositeTokenCacheInvalidator
,
schedulerCache
,
configConfig
,
tempUnschedCache
,
privacyClientFactory
,
proxyRepository
,
o
A
uthRefreshAPI
)
accountExpiryService
:=
service
.
ProvideAccountExpiryService
(
accountRepository
)
subscriptionExpiryService
:=
service
.
ProvideSubscriptionExpiryService
(
userSubscriptionRepository
)
scheduledTestRunnerService
:=
service
.
ProvideScheduledTestRunnerService
(
scheduledTestPlanRepository
,
scheduledTestService
,
accountTestService
,
rateLimitService
,
configConfig
)
...
...
backend/ent/migrate/schema.go
View file @
0b746501
...
...
@@ -616,6 +616,7 @@ var (
{
Name
:
"sort_order"
,
Type
:
field
.
TypeInt
,
Default
:
0
},
{
Name
:
"limits"
,
Type
:
field
.
TypeString
,
Default
:
""
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"text"
}},
{
Name
:
"refund_enabled"
,
Type
:
field
.
TypeBool
,
Default
:
false
},
{
Name
:
"allow_user_refund"
,
Type
:
field
.
TypeBool
,
Default
:
false
},
{
Name
:
"created_at"
,
Type
:
field
.
TypeTime
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"timestamptz"
}},
{
Name
:
"updated_at"
,
Type
:
field
.
TypeTime
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"timestamptz"
}},
}
...
...
@@ -1078,6 +1079,11 @@ var (
{
Name
:
"totp_secret_encrypted"
,
Type
:
field
.
TypeString
,
Nullable
:
true
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"text"
}},
{
Name
:
"totp_enabled"
,
Type
:
field
.
TypeBool
,
Default
:
false
},
{
Name
:
"totp_enabled_at"
,
Type
:
field
.
TypeTime
,
Nullable
:
true
},
{
Name
:
"balance_notify_enabled"
,
Type
:
field
.
TypeBool
,
Default
:
true
},
{
Name
:
"balance_notify_threshold_type"
,
Type
:
field
.
TypeString
,
Default
:
"fixed"
},
{
Name
:
"balance_notify_threshold"
,
Type
:
field
.
TypeFloat64
,
Nullable
:
true
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"decimal(20,8)"
}},
{
Name
:
"balance_notify_extra_emails"
,
Type
:
field
.
TypeString
,
Default
:
"[]"
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"text"
}},
{
Name
:
"total_recharged"
,
Type
:
field
.
TypeFloat64
,
Default
:
0
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"decimal(20,8)"
}},
}
// UsersTable holds the schema information for the "users" table.
UsersTable
=
&
schema
.
Table
{
...
...
backend/ent/mutation.go
View file @
0b746501
This diff is collapsed.
Click to expand it.
backend/ent/paymentproviderinstance.go
View file @
0b746501
...
...
@@ -35,6 +35,8 @@ type PaymentProviderInstance struct {
Limits
string
`json:"limits,omitempty"`
// RefundEnabled holds the value of the "refund_enabled" field.
RefundEnabled
bool
`json:"refund_enabled,omitempty"`
// AllowUserRefund holds the value of the "allow_user_refund" field.
AllowUserRefund
bool
`json:"allow_user_refund,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt
time
.
Time
`json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
...
...
@@ -47,7 +49,7 @@ func (*PaymentProviderInstance) scanValues(columns []string) ([]any, error) {
values
:=
make
([]
any
,
len
(
columns
))
for
i
:=
range
columns
{
switch
columns
[
i
]
{
case
paymentproviderinstance
.
FieldEnabled
,
paymentproviderinstance
.
FieldRefundEnabled
:
case
paymentproviderinstance
.
FieldEnabled
,
paymentproviderinstance
.
FieldRefundEnabled
,
paymentproviderinstance
.
FieldAllowUserRefund
:
values
[
i
]
=
new
(
sql
.
NullBool
)
case
paymentproviderinstance
.
FieldID
,
paymentproviderinstance
.
FieldSortOrder
:
values
[
i
]
=
new
(
sql
.
NullInt64
)
...
...
@@ -130,6 +132,12 @@ func (_m *PaymentProviderInstance) assignValues(columns []string, values []any)
}
else
if
value
.
Valid
{
_m
.
RefundEnabled
=
value
.
Bool
}
case
paymentproviderinstance
.
FieldAllowUserRefund
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullBool
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field allow_user_refund"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
AllowUserRefund
=
value
.
Bool
}
case
paymentproviderinstance
.
FieldCreatedAt
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullTime
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field created_at"
,
values
[
i
])
...
...
@@ -205,6 +213,9 @@ func (_m *PaymentProviderInstance) String() string {
builder
.
WriteString
(
"refund_enabled="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
RefundEnabled
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"allow_user_refund="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
AllowUserRefund
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"created_at="
)
builder
.
WriteString
(
_m
.
CreatedAt
.
Format
(
time
.
ANSIC
))
builder
.
WriteString
(
", "
)
...
...
backend/ent/paymentproviderinstance/paymentproviderinstance.go
View file @
0b746501
...
...
@@ -31,6 +31,8 @@ const (
FieldLimits
=
"limits"
// FieldRefundEnabled holds the string denoting the refund_enabled field in the database.
FieldRefundEnabled
=
"refund_enabled"
// FieldAllowUserRefund holds the string denoting the allow_user_refund field in the database.
FieldAllowUserRefund
=
"allow_user_refund"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt
=
"created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
...
...
@@ -51,6 +53,7 @@ var Columns = []string{
FieldSortOrder
,
FieldLimits
,
FieldRefundEnabled
,
FieldAllowUserRefund
,
FieldCreatedAt
,
FieldUpdatedAt
,
}
...
...
@@ -88,6 +91,8 @@ var (
DefaultLimits
string
// DefaultRefundEnabled holds the default value on creation for the "refund_enabled" field.
DefaultRefundEnabled
bool
// DefaultAllowUserRefund holds the default value on creation for the "allow_user_refund" field.
DefaultAllowUserRefund
bool
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt
func
()
time
.
Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
...
...
@@ -149,6 +154,11 @@ func ByRefundEnabled(opts ...sql.OrderTermOption) OrderOption {
return
sql
.
OrderByField
(
FieldRefundEnabled
,
opts
...
)
.
ToFunc
()
}
// ByAllowUserRefund orders the results by the allow_user_refund field.
func
ByAllowUserRefund
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldAllowUserRefund
,
opts
...
)
.
ToFunc
()
}
// ByCreatedAt orders the results by the created_at field.
func
ByCreatedAt
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldCreatedAt
,
opts
...
)
.
ToFunc
()
...
...
backend/ent/paymentproviderinstance/where.go
View file @
0b746501
...
...
@@ -99,6 +99,11 @@ func RefundEnabled(v bool) predicate.PaymentProviderInstance {
return
predicate
.
PaymentProviderInstance
(
sql
.
FieldEQ
(
FieldRefundEnabled
,
v
))
}
// AllowUserRefund applies equality check predicate on the "allow_user_refund" field. It's identical to AllowUserRefundEQ.
func
AllowUserRefund
(
v
bool
)
predicate
.
PaymentProviderInstance
{
return
predicate
.
PaymentProviderInstance
(
sql
.
FieldEQ
(
FieldAllowUserRefund
,
v
))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func
CreatedAt
(
v
time
.
Time
)
predicate
.
PaymentProviderInstance
{
return
predicate
.
PaymentProviderInstance
(
sql
.
FieldEQ
(
FieldCreatedAt
,
v
))
...
...
@@ -559,6 +564,16 @@ func RefundEnabledNEQ(v bool) predicate.PaymentProviderInstance {
return
predicate
.
PaymentProviderInstance
(
sql
.
FieldNEQ
(
FieldRefundEnabled
,
v
))
}
// AllowUserRefundEQ applies the EQ predicate on the "allow_user_refund" field.
func
AllowUserRefundEQ
(
v
bool
)
predicate
.
PaymentProviderInstance
{
return
predicate
.
PaymentProviderInstance
(
sql
.
FieldEQ
(
FieldAllowUserRefund
,
v
))
}
// AllowUserRefundNEQ applies the NEQ predicate on the "allow_user_refund" field.
func
AllowUserRefundNEQ
(
v
bool
)
predicate
.
PaymentProviderInstance
{
return
predicate
.
PaymentProviderInstance
(
sql
.
FieldNEQ
(
FieldAllowUserRefund
,
v
))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func
CreatedAtEQ
(
v
time
.
Time
)
predicate
.
PaymentProviderInstance
{
return
predicate
.
PaymentProviderInstance
(
sql
.
FieldEQ
(
FieldCreatedAt
,
v
))
...
...
backend/ent/paymentproviderinstance_create.go
View file @
0b746501
...
...
@@ -132,6 +132,20 @@ func (_c *PaymentProviderInstanceCreate) SetNillableRefundEnabled(v *bool) *Paym
return
_c
}
// SetAllowUserRefund sets the "allow_user_refund" field.
func
(
_c
*
PaymentProviderInstanceCreate
)
SetAllowUserRefund
(
v
bool
)
*
PaymentProviderInstanceCreate
{
_c
.
mutation
.
SetAllowUserRefund
(
v
)
return
_c
}
// SetNillableAllowUserRefund sets the "allow_user_refund" field if the given value is not nil.
func
(
_c
*
PaymentProviderInstanceCreate
)
SetNillableAllowUserRefund
(
v
*
bool
)
*
PaymentProviderInstanceCreate
{
if
v
!=
nil
{
_c
.
SetAllowUserRefund
(
*
v
)
}
return
_c
}
// SetCreatedAt sets the "created_at" field.
func
(
_c
*
PaymentProviderInstanceCreate
)
SetCreatedAt
(
v
time
.
Time
)
*
PaymentProviderInstanceCreate
{
_c
.
mutation
.
SetCreatedAt
(
v
)
...
...
@@ -223,6 +237,10 @@ func (_c *PaymentProviderInstanceCreate) defaults() {
v
:=
paymentproviderinstance
.
DefaultRefundEnabled
_c
.
mutation
.
SetRefundEnabled
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
AllowUserRefund
();
!
ok
{
v
:=
paymentproviderinstance
.
DefaultAllowUserRefund
_c
.
mutation
.
SetAllowUserRefund
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
CreatedAt
();
!
ok
{
v
:=
paymentproviderinstance
.
DefaultCreatedAt
()
_c
.
mutation
.
SetCreatedAt
(
v
)
...
...
@@ -282,6 +300,9 @@ func (_c *PaymentProviderInstanceCreate) check() error {
if
_
,
ok
:=
_c
.
mutation
.
RefundEnabled
();
!
ok
{
return
&
ValidationError
{
Name
:
"refund_enabled"
,
err
:
errors
.
New
(
`ent: missing required field "PaymentProviderInstance.refund_enabled"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
AllowUserRefund
();
!
ok
{
return
&
ValidationError
{
Name
:
"allow_user_refund"
,
err
:
errors
.
New
(
`ent: missing required field "PaymentProviderInstance.allow_user_refund"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
CreatedAt
();
!
ok
{
return
&
ValidationError
{
Name
:
"created_at"
,
err
:
errors
.
New
(
`ent: missing required field "PaymentProviderInstance.created_at"`
)}
}
...
...
@@ -351,6 +372,10 @@ func (_c *PaymentProviderInstanceCreate) createSpec() (*PaymentProviderInstance,
_spec
.
SetField
(
paymentproviderinstance
.
FieldRefundEnabled
,
field
.
TypeBool
,
value
)
_node
.
RefundEnabled
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
AllowUserRefund
();
ok
{
_spec
.
SetField
(
paymentproviderinstance
.
FieldAllowUserRefund
,
field
.
TypeBool
,
value
)
_node
.
AllowUserRefund
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
CreatedAt
();
ok
{
_spec
.
SetField
(
paymentproviderinstance
.
FieldCreatedAt
,
field
.
TypeTime
,
value
)
_node
.
CreatedAt
=
value
...
...
@@ -525,6 +550,18 @@ func (u *PaymentProviderInstanceUpsert) UpdateRefundEnabled() *PaymentProviderIn
return
u
}
// SetAllowUserRefund sets the "allow_user_refund" field.
func
(
u
*
PaymentProviderInstanceUpsert
)
SetAllowUserRefund
(
v
bool
)
*
PaymentProviderInstanceUpsert
{
u
.
Set
(
paymentproviderinstance
.
FieldAllowUserRefund
,
v
)
return
u
}
// UpdateAllowUserRefund sets the "allow_user_refund" field to the value that was provided on create.
func
(
u
*
PaymentProviderInstanceUpsert
)
UpdateAllowUserRefund
()
*
PaymentProviderInstanceUpsert
{
u
.
SetExcluded
(
paymentproviderinstance
.
FieldAllowUserRefund
)
return
u
}
// SetUpdatedAt sets the "updated_at" field.
func
(
u
*
PaymentProviderInstanceUpsert
)
SetUpdatedAt
(
v
time
.
Time
)
*
PaymentProviderInstanceUpsert
{
u
.
Set
(
paymentproviderinstance
.
FieldUpdatedAt
,
v
)
...
...
@@ -715,6 +752,20 @@ func (u *PaymentProviderInstanceUpsertOne) UpdateRefundEnabled() *PaymentProvide
})
}
// SetAllowUserRefund sets the "allow_user_refund" field.
func
(
u
*
PaymentProviderInstanceUpsertOne
)
SetAllowUserRefund
(
v
bool
)
*
PaymentProviderInstanceUpsertOne
{
return
u
.
Update
(
func
(
s
*
PaymentProviderInstanceUpsert
)
{
s
.
SetAllowUserRefund
(
v
)
})
}
// UpdateAllowUserRefund sets the "allow_user_refund" field to the value that was provided on create.
func
(
u
*
PaymentProviderInstanceUpsertOne
)
UpdateAllowUserRefund
()
*
PaymentProviderInstanceUpsertOne
{
return
u
.
Update
(
func
(
s
*
PaymentProviderInstanceUpsert
)
{
s
.
UpdateAllowUserRefund
()
})
}
// SetUpdatedAt sets the "updated_at" field.
func
(
u
*
PaymentProviderInstanceUpsertOne
)
SetUpdatedAt
(
v
time
.
Time
)
*
PaymentProviderInstanceUpsertOne
{
return
u
.
Update
(
func
(
s
*
PaymentProviderInstanceUpsert
)
{
...
...
@@ -1073,6 +1124,20 @@ func (u *PaymentProviderInstanceUpsertBulk) UpdateRefundEnabled() *PaymentProvid
})
}
// SetAllowUserRefund sets the "allow_user_refund" field.
func
(
u
*
PaymentProviderInstanceUpsertBulk
)
SetAllowUserRefund
(
v
bool
)
*
PaymentProviderInstanceUpsertBulk
{
return
u
.
Update
(
func
(
s
*
PaymentProviderInstanceUpsert
)
{
s
.
SetAllowUserRefund
(
v
)
})
}
// UpdateAllowUserRefund sets the "allow_user_refund" field to the value that was provided on create.
func
(
u
*
PaymentProviderInstanceUpsertBulk
)
UpdateAllowUserRefund
()
*
PaymentProviderInstanceUpsertBulk
{
return
u
.
Update
(
func
(
s
*
PaymentProviderInstanceUpsert
)
{
s
.
UpdateAllowUserRefund
()
})
}
// SetUpdatedAt sets the "updated_at" field.
func
(
u
*
PaymentProviderInstanceUpsertBulk
)
SetUpdatedAt
(
v
time
.
Time
)
*
PaymentProviderInstanceUpsertBulk
{
return
u
.
Update
(
func
(
s
*
PaymentProviderInstanceUpsert
)
{
...
...
backend/ent/paymentproviderinstance_update.go
View file @
0b746501
...
...
@@ -161,6 +161,20 @@ func (_u *PaymentProviderInstanceUpdate) SetNillableRefundEnabled(v *bool) *Paym
return
_u
}
// SetAllowUserRefund sets the "allow_user_refund" field.
func
(
_u
*
PaymentProviderInstanceUpdate
)
SetAllowUserRefund
(
v
bool
)
*
PaymentProviderInstanceUpdate
{
_u
.
mutation
.
SetAllowUserRefund
(
v
)
return
_u
}
// SetNillableAllowUserRefund sets the "allow_user_refund" field if the given value is not nil.
func
(
_u
*
PaymentProviderInstanceUpdate
)
SetNillableAllowUserRefund
(
v
*
bool
)
*
PaymentProviderInstanceUpdate
{
if
v
!=
nil
{
_u
.
SetAllowUserRefund
(
*
v
)
}
return
_u
}
// SetUpdatedAt sets the "updated_at" field.
func
(
_u
*
PaymentProviderInstanceUpdate
)
SetUpdatedAt
(
v
time
.
Time
)
*
PaymentProviderInstanceUpdate
{
_u
.
mutation
.
SetUpdatedAt
(
v
)
...
...
@@ -275,6 +289,9 @@ func (_u *PaymentProviderInstanceUpdate) sqlSave(ctx context.Context) (_node int
if
value
,
ok
:=
_u
.
mutation
.
RefundEnabled
();
ok
{
_spec
.
SetField
(
paymentproviderinstance
.
FieldRefundEnabled
,
field
.
TypeBool
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AllowUserRefund
();
ok
{
_spec
.
SetField
(
paymentproviderinstance
.
FieldAllowUserRefund
,
field
.
TypeBool
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
UpdatedAt
();
ok
{
_spec
.
SetField
(
paymentproviderinstance
.
FieldUpdatedAt
,
field
.
TypeTime
,
value
)
}
...
...
@@ -431,6 +448,20 @@ func (_u *PaymentProviderInstanceUpdateOne) SetNillableRefundEnabled(v *bool) *P
return
_u
}
// SetAllowUserRefund sets the "allow_user_refund" field.
func
(
_u
*
PaymentProviderInstanceUpdateOne
)
SetAllowUserRefund
(
v
bool
)
*
PaymentProviderInstanceUpdateOne
{
_u
.
mutation
.
SetAllowUserRefund
(
v
)
return
_u
}
// SetNillableAllowUserRefund sets the "allow_user_refund" field if the given value is not nil.
func
(
_u
*
PaymentProviderInstanceUpdateOne
)
SetNillableAllowUserRefund
(
v
*
bool
)
*
PaymentProviderInstanceUpdateOne
{
if
v
!=
nil
{
_u
.
SetAllowUserRefund
(
*
v
)
}
return
_u
}
// SetUpdatedAt sets the "updated_at" field.
func
(
_u
*
PaymentProviderInstanceUpdateOne
)
SetUpdatedAt
(
v
time
.
Time
)
*
PaymentProviderInstanceUpdateOne
{
_u
.
mutation
.
SetUpdatedAt
(
v
)
...
...
@@ -575,6 +606,9 @@ func (_u *PaymentProviderInstanceUpdateOne) sqlSave(ctx context.Context) (_node
if
value
,
ok
:=
_u
.
mutation
.
RefundEnabled
();
ok
{
_spec
.
SetField
(
paymentproviderinstance
.
FieldRefundEnabled
,
field
.
TypeBool
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AllowUserRefund
();
ok
{
_spec
.
SetField
(
paymentproviderinstance
.
FieldAllowUserRefund
,
field
.
TypeBool
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
UpdatedAt
();
ok
{
_spec
.
SetField
(
paymentproviderinstance
.
FieldUpdatedAt
,
field
.
TypeTime
,
value
)
}
...
...
backend/ent/runtime/runtime.go
View file @
0b746501
...
...
@@ -668,12 +668,16 @@ func init() {
paymentproviderinstanceDescRefundEnabled
:=
paymentproviderinstanceFields
[
8
]
.
Descriptor
()
// paymentproviderinstance.DefaultRefundEnabled holds the default value on creation for the refund_enabled field.
paymentproviderinstance
.
DefaultRefundEnabled
=
paymentproviderinstanceDescRefundEnabled
.
Default
.
(
bool
)
// paymentproviderinstanceDescAllowUserRefund is the schema descriptor for allow_user_refund field.
paymentproviderinstanceDescAllowUserRefund
:=
paymentproviderinstanceFields
[
9
]
.
Descriptor
()
// paymentproviderinstance.DefaultAllowUserRefund holds the default value on creation for the allow_user_refund field.
paymentproviderinstance
.
DefaultAllowUserRefund
=
paymentproviderinstanceDescAllowUserRefund
.
Default
.
(
bool
)
// paymentproviderinstanceDescCreatedAt is the schema descriptor for created_at field.
paymentproviderinstanceDescCreatedAt
:=
paymentproviderinstanceFields
[
9
]
.
Descriptor
()
paymentproviderinstanceDescCreatedAt
:=
paymentproviderinstanceFields
[
10
]
.
Descriptor
()
// paymentproviderinstance.DefaultCreatedAt holds the default value on creation for the created_at field.
paymentproviderinstance
.
DefaultCreatedAt
=
paymentproviderinstanceDescCreatedAt
.
Default
.
(
func
()
time
.
Time
)
// paymentproviderinstanceDescUpdatedAt is the schema descriptor for updated_at field.
paymentproviderinstanceDescUpdatedAt
:=
paymentproviderinstanceFields
[
1
0
]
.
Descriptor
()
paymentproviderinstanceDescUpdatedAt
:=
paymentproviderinstanceFields
[
1
1
]
.
Descriptor
()
// paymentproviderinstance.DefaultUpdatedAt holds the default value on creation for the updated_at field.
paymentproviderinstance
.
DefaultUpdatedAt
=
paymentproviderinstanceDescUpdatedAt
.
Default
.
(
func
()
time
.
Time
)
// paymentproviderinstance.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
...
...
@@ -1293,6 +1297,22 @@ func init() {
userDescTotpEnabled
:=
userFields
[
9
]
.
Descriptor
()
// user.DefaultTotpEnabled holds the default value on creation for the totp_enabled field.
user
.
DefaultTotpEnabled
=
userDescTotpEnabled
.
Default
.
(
bool
)
// userDescBalanceNotifyEnabled is the schema descriptor for balance_notify_enabled field.
userDescBalanceNotifyEnabled
:=
userFields
[
11
]
.
Descriptor
()
// user.DefaultBalanceNotifyEnabled holds the default value on creation for the balance_notify_enabled field.
user
.
DefaultBalanceNotifyEnabled
=
userDescBalanceNotifyEnabled
.
Default
.
(
bool
)
// userDescBalanceNotifyThresholdType is the schema descriptor for balance_notify_threshold_type field.
userDescBalanceNotifyThresholdType
:=
userFields
[
12
]
.
Descriptor
()
// user.DefaultBalanceNotifyThresholdType holds the default value on creation for the balance_notify_threshold_type field.
user
.
DefaultBalanceNotifyThresholdType
=
userDescBalanceNotifyThresholdType
.
Default
.
(
string
)
// userDescBalanceNotifyExtraEmails is the schema descriptor for balance_notify_extra_emails field.
userDescBalanceNotifyExtraEmails
:=
userFields
[
14
]
.
Descriptor
()
// user.DefaultBalanceNotifyExtraEmails holds the default value on creation for the balance_notify_extra_emails field.
user
.
DefaultBalanceNotifyExtraEmails
=
userDescBalanceNotifyExtraEmails
.
Default
.
(
string
)
// userDescTotalRecharged is the schema descriptor for total_recharged field.
userDescTotalRecharged
:=
userFields
[
15
]
.
Descriptor
()
// user.DefaultTotalRecharged holds the default value on creation for the total_recharged field.
user
.
DefaultTotalRecharged
=
userDescTotalRecharged
.
Default
.
(
float64
)
userallowedgroupFields
:=
schema
.
UserAllowedGroup
{}
.
Fields
()
_
=
userallowedgroupFields
// userallowedgroupDescCreatedAt is the schema descriptor for created_at field.
...
...
backend/ent/schema/payment_provider_instance.go
View file @
0b746501
...
...
@@ -53,6 +53,8 @@ func (PaymentProviderInstance) Fields() []ent.Field {
Default
(
""
),
field
.
Bool
(
"refund_enabled"
)
.
Default
(
false
),
field
.
Bool
(
"allow_user_refund"
)
.
Default
(
false
),
field
.
Time
(
"created_at"
)
.
Immutable
()
.
Default
(
time
.
Now
)
.
...
...
backend/ent/schema/user.go
View file @
0b746501
...
...
@@ -72,6 +72,22 @@ func (User) Fields() []ent.Field {
field
.
Time
(
"totp_enabled_at"
)
.
Optional
()
.
Nillable
(),
// 余额不足通知
field
.
Bool
(
"balance_notify_enabled"
)
.
Default
(
true
),
field
.
String
(
"balance_notify_threshold_type"
)
.
Default
(
"fixed"
),
// "fixed" | "percentage"
field
.
Float
(
"balance_notify_threshold"
)
.
SchemaType
(
map
[
string
]
string
{
dialect
.
Postgres
:
"decimal(20,8)"
})
.
Optional
()
.
Nillable
(),
field
.
String
(
"balance_notify_extra_emails"
)
.
SchemaType
(
map
[
string
]
string
{
dialect
.
Postgres
:
"text"
})
.
Default
(
"[]"
),
field
.
Float
(
"total_recharged"
)
.
SchemaType
(
map
[
string
]
string
{
dialect
.
Postgres
:
"decimal(20,8)"
})
.
Default
(
0
),
}
}
...
...
backend/ent/user.go
View file @
0b746501
...
...
@@ -45,6 +45,16 @@ type User struct {
TotpEnabled
bool
`json:"totp_enabled,omitempty"`
// TotpEnabledAt holds the value of the "totp_enabled_at" field.
TotpEnabledAt
*
time
.
Time
`json:"totp_enabled_at,omitempty"`
// BalanceNotifyEnabled holds the value of the "balance_notify_enabled" field.
BalanceNotifyEnabled
bool
`json:"balance_notify_enabled,omitempty"`
// BalanceNotifyThresholdType holds the value of the "balance_notify_threshold_type" field.
BalanceNotifyThresholdType
string
`json:"balance_notify_threshold_type,omitempty"`
// BalanceNotifyThreshold holds the value of the "balance_notify_threshold" field.
BalanceNotifyThreshold
*
float64
`json:"balance_notify_threshold,omitempty"`
// BalanceNotifyExtraEmails holds the value of the "balance_notify_extra_emails" field.
BalanceNotifyExtraEmails
string
`json:"balance_notify_extra_emails,omitempty"`
// TotalRecharged holds the value of the "total_recharged" field.
TotalRecharged
float64
`json:"total_recharged,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the UserQuery when eager-loading is set.
Edges
UserEdges
`json:"edges"`
...
...
@@ -184,13 +194,13 @@ func (*User) scanValues(columns []string) ([]any, error) {
values
:=
make
([]
any
,
len
(
columns
))
for
i
:=
range
columns
{
switch
columns
[
i
]
{
case
user
.
FieldTotpEnabled
:
case
user
.
FieldTotpEnabled
,
user
.
FieldBalanceNotifyEnabled
:
values
[
i
]
=
new
(
sql
.
NullBool
)
case
user
.
FieldBalance
:
case
user
.
FieldBalance
,
user
.
FieldBalanceNotifyThreshold
,
user
.
FieldTotalRecharged
:
values
[
i
]
=
new
(
sql
.
NullFloat64
)
case
user
.
FieldID
,
user
.
FieldConcurrency
:
values
[
i
]
=
new
(
sql
.
NullInt64
)
case
user
.
FieldEmail
,
user
.
FieldPasswordHash
,
user
.
FieldRole
,
user
.
FieldStatus
,
user
.
FieldUsername
,
user
.
FieldNotes
,
user
.
FieldTotpSecretEncrypted
:
case
user
.
FieldEmail
,
user
.
FieldPasswordHash
,
user
.
FieldRole
,
user
.
FieldStatus
,
user
.
FieldUsername
,
user
.
FieldNotes
,
user
.
FieldTotpSecretEncrypted
,
user
.
FieldBalanceNotifyThresholdType
,
user
.
FieldBalanceNotifyExtraEmails
:
values
[
i
]
=
new
(
sql
.
NullString
)
case
user
.
FieldCreatedAt
,
user
.
FieldUpdatedAt
,
user
.
FieldDeletedAt
,
user
.
FieldTotpEnabledAt
:
values
[
i
]
=
new
(
sql
.
NullTime
)
...
...
@@ -302,6 +312,37 @@ func (_m *User) assignValues(columns []string, values []any) error {
_m
.
TotpEnabledAt
=
new
(
time
.
Time
)
*
_m
.
TotpEnabledAt
=
value
.
Time
}
case
user
.
FieldBalanceNotifyEnabled
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullBool
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field balance_notify_enabled"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
BalanceNotifyEnabled
=
value
.
Bool
}
case
user
.
FieldBalanceNotifyThresholdType
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field balance_notify_threshold_type"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
BalanceNotifyThresholdType
=
value
.
String
}
case
user
.
FieldBalanceNotifyThreshold
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullFloat64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field balance_notify_threshold"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
BalanceNotifyThreshold
=
new
(
float64
)
*
_m
.
BalanceNotifyThreshold
=
value
.
Float64
}
case
user
.
FieldBalanceNotifyExtraEmails
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field balance_notify_extra_emails"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
BalanceNotifyExtraEmails
=
value
.
String
}
case
user
.
FieldTotalRecharged
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullFloat64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field total_recharged"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
TotalRecharged
=
value
.
Float64
}
default
:
_m
.
selectValues
.
Set
(
columns
[
i
],
values
[
i
])
}
...
...
@@ -440,6 +481,23 @@ func (_m *User) String() string {
builder
.
WriteString
(
"totp_enabled_at="
)
builder
.
WriteString
(
v
.
Format
(
time
.
ANSIC
))
}
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"balance_notify_enabled="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
BalanceNotifyEnabled
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"balance_notify_threshold_type="
)
builder
.
WriteString
(
_m
.
BalanceNotifyThresholdType
)
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
BalanceNotifyThreshold
;
v
!=
nil
{
builder
.
WriteString
(
"balance_notify_threshold="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
*
v
))
}
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"balance_notify_extra_emails="
)
builder
.
WriteString
(
_m
.
BalanceNotifyExtraEmails
)
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"total_recharged="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
TotalRecharged
))
builder
.
WriteByte
(
')'
)
return
builder
.
String
()
}
...
...
backend/ent/user/user.go
View file @
0b746501
...
...
@@ -43,6 +43,16 @@ const (
FieldTotpEnabled
=
"totp_enabled"
// FieldTotpEnabledAt holds the string denoting the totp_enabled_at field in the database.
FieldTotpEnabledAt
=
"totp_enabled_at"
// FieldBalanceNotifyEnabled holds the string denoting the balance_notify_enabled field in the database.
FieldBalanceNotifyEnabled
=
"balance_notify_enabled"
// FieldBalanceNotifyThresholdType holds the string denoting the balance_notify_threshold_type field in the database.
FieldBalanceNotifyThresholdType
=
"balance_notify_threshold_type"
// FieldBalanceNotifyThreshold holds the string denoting the balance_notify_threshold field in the database.
FieldBalanceNotifyThreshold
=
"balance_notify_threshold"
// FieldBalanceNotifyExtraEmails holds the string denoting the balance_notify_extra_emails field in the database.
FieldBalanceNotifyExtraEmails
=
"balance_notify_extra_emails"
// FieldTotalRecharged holds the string denoting the total_recharged field in the database.
FieldTotalRecharged
=
"total_recharged"
// EdgeAPIKeys holds the string denoting the api_keys edge name in mutations.
EdgeAPIKeys
=
"api_keys"
// EdgeRedeemCodes holds the string denoting the redeem_codes edge name in mutations.
...
...
@@ -161,6 +171,11 @@ var Columns = []string{
FieldTotpSecretEncrypted
,
FieldTotpEnabled
,
FieldTotpEnabledAt
,
FieldBalanceNotifyEnabled
,
FieldBalanceNotifyThresholdType
,
FieldBalanceNotifyThreshold
,
FieldBalanceNotifyExtraEmails
,
FieldTotalRecharged
,
}
var
(
...
...
@@ -217,6 +232,14 @@ var (
DefaultNotes
string
// DefaultTotpEnabled holds the default value on creation for the "totp_enabled" field.
DefaultTotpEnabled
bool
// DefaultBalanceNotifyEnabled holds the default value on creation for the "balance_notify_enabled" field.
DefaultBalanceNotifyEnabled
bool
// DefaultBalanceNotifyThresholdType holds the default value on creation for the "balance_notify_threshold_type" field.
DefaultBalanceNotifyThresholdType
string
// DefaultBalanceNotifyExtraEmails holds the default value on creation for the "balance_notify_extra_emails" field.
DefaultBalanceNotifyExtraEmails
string
// DefaultTotalRecharged holds the default value on creation for the "total_recharged" field.
DefaultTotalRecharged
float64
)
// OrderOption defines the ordering options for the User queries.
...
...
@@ -297,6 +320,31 @@ func ByTotpEnabledAt(opts ...sql.OrderTermOption) OrderOption {
return
sql
.
OrderByField
(
FieldTotpEnabledAt
,
opts
...
)
.
ToFunc
()
}
// ByBalanceNotifyEnabled orders the results by the balance_notify_enabled field.
func
ByBalanceNotifyEnabled
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldBalanceNotifyEnabled
,
opts
...
)
.
ToFunc
()
}
// ByBalanceNotifyThresholdType orders the results by the balance_notify_threshold_type field.
func
ByBalanceNotifyThresholdType
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldBalanceNotifyThresholdType
,
opts
...
)
.
ToFunc
()
}
// ByBalanceNotifyThreshold orders the results by the balance_notify_threshold field.
func
ByBalanceNotifyThreshold
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldBalanceNotifyThreshold
,
opts
...
)
.
ToFunc
()
}
// ByBalanceNotifyExtraEmails orders the results by the balance_notify_extra_emails field.
func
ByBalanceNotifyExtraEmails
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldBalanceNotifyExtraEmails
,
opts
...
)
.
ToFunc
()
}
// ByTotalRecharged orders the results by the total_recharged field.
func
ByTotalRecharged
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldTotalRecharged
,
opts
...
)
.
ToFunc
()
}
// ByAPIKeysCount orders the results by api_keys count.
func
ByAPIKeysCount
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
func
(
s
*
sql
.
Selector
)
{
...
...
backend/ent/user/where.go
View file @
0b746501
...
...
@@ -125,6 +125,31 @@ func TotpEnabledAt(v time.Time) predicate.User {
return
predicate
.
User
(
sql
.
FieldEQ
(
FieldTotpEnabledAt
,
v
))
}
// BalanceNotifyEnabled applies equality check predicate on the "balance_notify_enabled" field. It's identical to BalanceNotifyEnabledEQ.
func
BalanceNotifyEnabled
(
v
bool
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEQ
(
FieldBalanceNotifyEnabled
,
v
))
}
// BalanceNotifyThresholdType applies equality check predicate on the "balance_notify_threshold_type" field. It's identical to BalanceNotifyThresholdTypeEQ.
func
BalanceNotifyThresholdType
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEQ
(
FieldBalanceNotifyThresholdType
,
v
))
}
// BalanceNotifyThreshold applies equality check predicate on the "balance_notify_threshold" field. It's identical to BalanceNotifyThresholdEQ.
func
BalanceNotifyThreshold
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEQ
(
FieldBalanceNotifyThreshold
,
v
))
}
// BalanceNotifyExtraEmails applies equality check predicate on the "balance_notify_extra_emails" field. It's identical to BalanceNotifyExtraEmailsEQ.
func
BalanceNotifyExtraEmails
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEQ
(
FieldBalanceNotifyExtraEmails
,
v
))
}
// TotalRecharged applies equality check predicate on the "total_recharged" field. It's identical to TotalRechargedEQ.
func
TotalRecharged
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEQ
(
FieldTotalRecharged
,
v
))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func
CreatedAtEQ
(
v
time
.
Time
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEQ
(
FieldCreatedAt
,
v
))
...
...
@@ -860,6 +885,236 @@ func TotpEnabledAtNotNil() predicate.User {
return
predicate
.
User
(
sql
.
FieldNotNull
(
FieldTotpEnabledAt
))
}
// BalanceNotifyEnabledEQ applies the EQ predicate on the "balance_notify_enabled" field.
func
BalanceNotifyEnabledEQ
(
v
bool
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEQ
(
FieldBalanceNotifyEnabled
,
v
))
}
// BalanceNotifyEnabledNEQ applies the NEQ predicate on the "balance_notify_enabled" field.
func
BalanceNotifyEnabledNEQ
(
v
bool
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldNEQ
(
FieldBalanceNotifyEnabled
,
v
))
}
// BalanceNotifyThresholdTypeEQ applies the EQ predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeEQ
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEQ
(
FieldBalanceNotifyThresholdType
,
v
))
}
// BalanceNotifyThresholdTypeNEQ applies the NEQ predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeNEQ
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldNEQ
(
FieldBalanceNotifyThresholdType
,
v
))
}
// BalanceNotifyThresholdTypeIn applies the In predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeIn
(
vs
...
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldIn
(
FieldBalanceNotifyThresholdType
,
vs
...
))
}
// BalanceNotifyThresholdTypeNotIn applies the NotIn predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeNotIn
(
vs
...
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldNotIn
(
FieldBalanceNotifyThresholdType
,
vs
...
))
}
// BalanceNotifyThresholdTypeGT applies the GT predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeGT
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldGT
(
FieldBalanceNotifyThresholdType
,
v
))
}
// BalanceNotifyThresholdTypeGTE applies the GTE predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeGTE
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldGTE
(
FieldBalanceNotifyThresholdType
,
v
))
}
// BalanceNotifyThresholdTypeLT applies the LT predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeLT
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldLT
(
FieldBalanceNotifyThresholdType
,
v
))
}
// BalanceNotifyThresholdTypeLTE applies the LTE predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeLTE
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldLTE
(
FieldBalanceNotifyThresholdType
,
v
))
}
// BalanceNotifyThresholdTypeContains applies the Contains predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeContains
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldContains
(
FieldBalanceNotifyThresholdType
,
v
))
}
// BalanceNotifyThresholdTypeHasPrefix applies the HasPrefix predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeHasPrefix
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldHasPrefix
(
FieldBalanceNotifyThresholdType
,
v
))
}
// BalanceNotifyThresholdTypeHasSuffix applies the HasSuffix predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeHasSuffix
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldHasSuffix
(
FieldBalanceNotifyThresholdType
,
v
))
}
// BalanceNotifyThresholdTypeEqualFold applies the EqualFold predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeEqualFold
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEqualFold
(
FieldBalanceNotifyThresholdType
,
v
))
}
// BalanceNotifyThresholdTypeContainsFold applies the ContainsFold predicate on the "balance_notify_threshold_type" field.
func
BalanceNotifyThresholdTypeContainsFold
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldContainsFold
(
FieldBalanceNotifyThresholdType
,
v
))
}
// BalanceNotifyThresholdEQ applies the EQ predicate on the "balance_notify_threshold" field.
func
BalanceNotifyThresholdEQ
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEQ
(
FieldBalanceNotifyThreshold
,
v
))
}
// BalanceNotifyThresholdNEQ applies the NEQ predicate on the "balance_notify_threshold" field.
func
BalanceNotifyThresholdNEQ
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldNEQ
(
FieldBalanceNotifyThreshold
,
v
))
}
// BalanceNotifyThresholdIn applies the In predicate on the "balance_notify_threshold" field.
func
BalanceNotifyThresholdIn
(
vs
...
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldIn
(
FieldBalanceNotifyThreshold
,
vs
...
))
}
// BalanceNotifyThresholdNotIn applies the NotIn predicate on the "balance_notify_threshold" field.
func
BalanceNotifyThresholdNotIn
(
vs
...
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldNotIn
(
FieldBalanceNotifyThreshold
,
vs
...
))
}
// BalanceNotifyThresholdGT applies the GT predicate on the "balance_notify_threshold" field.
func
BalanceNotifyThresholdGT
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldGT
(
FieldBalanceNotifyThreshold
,
v
))
}
// BalanceNotifyThresholdGTE applies the GTE predicate on the "balance_notify_threshold" field.
func
BalanceNotifyThresholdGTE
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldGTE
(
FieldBalanceNotifyThreshold
,
v
))
}
// BalanceNotifyThresholdLT applies the LT predicate on the "balance_notify_threshold" field.
func
BalanceNotifyThresholdLT
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldLT
(
FieldBalanceNotifyThreshold
,
v
))
}
// BalanceNotifyThresholdLTE applies the LTE predicate on the "balance_notify_threshold" field.
func
BalanceNotifyThresholdLTE
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldLTE
(
FieldBalanceNotifyThreshold
,
v
))
}
// BalanceNotifyThresholdIsNil applies the IsNil predicate on the "balance_notify_threshold" field.
func
BalanceNotifyThresholdIsNil
()
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldIsNull
(
FieldBalanceNotifyThreshold
))
}
// BalanceNotifyThresholdNotNil applies the NotNil predicate on the "balance_notify_threshold" field.
func
BalanceNotifyThresholdNotNil
()
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldNotNull
(
FieldBalanceNotifyThreshold
))
}
// BalanceNotifyExtraEmailsEQ applies the EQ predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsEQ
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEQ
(
FieldBalanceNotifyExtraEmails
,
v
))
}
// BalanceNotifyExtraEmailsNEQ applies the NEQ predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsNEQ
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldNEQ
(
FieldBalanceNotifyExtraEmails
,
v
))
}
// BalanceNotifyExtraEmailsIn applies the In predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsIn
(
vs
...
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldIn
(
FieldBalanceNotifyExtraEmails
,
vs
...
))
}
// BalanceNotifyExtraEmailsNotIn applies the NotIn predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsNotIn
(
vs
...
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldNotIn
(
FieldBalanceNotifyExtraEmails
,
vs
...
))
}
// BalanceNotifyExtraEmailsGT applies the GT predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsGT
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldGT
(
FieldBalanceNotifyExtraEmails
,
v
))
}
// BalanceNotifyExtraEmailsGTE applies the GTE predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsGTE
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldGTE
(
FieldBalanceNotifyExtraEmails
,
v
))
}
// BalanceNotifyExtraEmailsLT applies the LT predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsLT
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldLT
(
FieldBalanceNotifyExtraEmails
,
v
))
}
// BalanceNotifyExtraEmailsLTE applies the LTE predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsLTE
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldLTE
(
FieldBalanceNotifyExtraEmails
,
v
))
}
// BalanceNotifyExtraEmailsContains applies the Contains predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsContains
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldContains
(
FieldBalanceNotifyExtraEmails
,
v
))
}
// BalanceNotifyExtraEmailsHasPrefix applies the HasPrefix predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsHasPrefix
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldHasPrefix
(
FieldBalanceNotifyExtraEmails
,
v
))
}
// BalanceNotifyExtraEmailsHasSuffix applies the HasSuffix predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsHasSuffix
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldHasSuffix
(
FieldBalanceNotifyExtraEmails
,
v
))
}
// BalanceNotifyExtraEmailsEqualFold applies the EqualFold predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsEqualFold
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEqualFold
(
FieldBalanceNotifyExtraEmails
,
v
))
}
// BalanceNotifyExtraEmailsContainsFold applies the ContainsFold predicate on the "balance_notify_extra_emails" field.
func
BalanceNotifyExtraEmailsContainsFold
(
v
string
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldContainsFold
(
FieldBalanceNotifyExtraEmails
,
v
))
}
// TotalRechargedEQ applies the EQ predicate on the "total_recharged" field.
func
TotalRechargedEQ
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldEQ
(
FieldTotalRecharged
,
v
))
}
// TotalRechargedNEQ applies the NEQ predicate on the "total_recharged" field.
func
TotalRechargedNEQ
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldNEQ
(
FieldTotalRecharged
,
v
))
}
// TotalRechargedIn applies the In predicate on the "total_recharged" field.
func
TotalRechargedIn
(
vs
...
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldIn
(
FieldTotalRecharged
,
vs
...
))
}
// TotalRechargedNotIn applies the NotIn predicate on the "total_recharged" field.
func
TotalRechargedNotIn
(
vs
...
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldNotIn
(
FieldTotalRecharged
,
vs
...
))
}
// TotalRechargedGT applies the GT predicate on the "total_recharged" field.
func
TotalRechargedGT
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldGT
(
FieldTotalRecharged
,
v
))
}
// TotalRechargedGTE applies the GTE predicate on the "total_recharged" field.
func
TotalRechargedGTE
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldGTE
(
FieldTotalRecharged
,
v
))
}
// TotalRechargedLT applies the LT predicate on the "total_recharged" field.
func
TotalRechargedLT
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldLT
(
FieldTotalRecharged
,
v
))
}
// TotalRechargedLTE applies the LTE predicate on the "total_recharged" field.
func
TotalRechargedLTE
(
v
float64
)
predicate
.
User
{
return
predicate
.
User
(
sql
.
FieldLTE
(
FieldTotalRecharged
,
v
))
}
// HasAPIKeys applies the HasEdge predicate on the "api_keys" edge.
func
HasAPIKeys
()
predicate
.
User
{
return
predicate
.
User
(
func
(
s
*
sql
.
Selector
)
{
...
...
backend/ent/user_create.go
View file @
0b746501
...
...
@@ -211,6 +211,76 @@ func (_c *UserCreate) SetNillableTotpEnabledAt(v *time.Time) *UserCreate {
return
_c
}
// SetBalanceNotifyEnabled sets the "balance_notify_enabled" field.
func
(
_c
*
UserCreate
)
SetBalanceNotifyEnabled
(
v
bool
)
*
UserCreate
{
_c
.
mutation
.
SetBalanceNotifyEnabled
(
v
)
return
_c
}
// SetNillableBalanceNotifyEnabled sets the "balance_notify_enabled" field if the given value is not nil.
func
(
_c
*
UserCreate
)
SetNillableBalanceNotifyEnabled
(
v
*
bool
)
*
UserCreate
{
if
v
!=
nil
{
_c
.
SetBalanceNotifyEnabled
(
*
v
)
}
return
_c
}
// SetBalanceNotifyThresholdType sets the "balance_notify_threshold_type" field.
func
(
_c
*
UserCreate
)
SetBalanceNotifyThresholdType
(
v
string
)
*
UserCreate
{
_c
.
mutation
.
SetBalanceNotifyThresholdType
(
v
)
return
_c
}
// SetNillableBalanceNotifyThresholdType sets the "balance_notify_threshold_type" field if the given value is not nil.
func
(
_c
*
UserCreate
)
SetNillableBalanceNotifyThresholdType
(
v
*
string
)
*
UserCreate
{
if
v
!=
nil
{
_c
.
SetBalanceNotifyThresholdType
(
*
v
)
}
return
_c
}
// SetBalanceNotifyThreshold sets the "balance_notify_threshold" field.
func
(
_c
*
UserCreate
)
SetBalanceNotifyThreshold
(
v
float64
)
*
UserCreate
{
_c
.
mutation
.
SetBalanceNotifyThreshold
(
v
)
return
_c
}
// SetNillableBalanceNotifyThreshold sets the "balance_notify_threshold" field if the given value is not nil.
func
(
_c
*
UserCreate
)
SetNillableBalanceNotifyThreshold
(
v
*
float64
)
*
UserCreate
{
if
v
!=
nil
{
_c
.
SetBalanceNotifyThreshold
(
*
v
)
}
return
_c
}
// SetBalanceNotifyExtraEmails sets the "balance_notify_extra_emails" field.
func
(
_c
*
UserCreate
)
SetBalanceNotifyExtraEmails
(
v
string
)
*
UserCreate
{
_c
.
mutation
.
SetBalanceNotifyExtraEmails
(
v
)
return
_c
}
// SetNillableBalanceNotifyExtraEmails sets the "balance_notify_extra_emails" field if the given value is not nil.
func
(
_c
*
UserCreate
)
SetNillableBalanceNotifyExtraEmails
(
v
*
string
)
*
UserCreate
{
if
v
!=
nil
{
_c
.
SetBalanceNotifyExtraEmails
(
*
v
)
}
return
_c
}
// SetTotalRecharged sets the "total_recharged" field.
func
(
_c
*
UserCreate
)
SetTotalRecharged
(
v
float64
)
*
UserCreate
{
_c
.
mutation
.
SetTotalRecharged
(
v
)
return
_c
}
// SetNillableTotalRecharged sets the "total_recharged" field if the given value is not nil.
func
(
_c
*
UserCreate
)
SetNillableTotalRecharged
(
v
*
float64
)
*
UserCreate
{
if
v
!=
nil
{
_c
.
SetTotalRecharged
(
*
v
)
}
return
_c
}
// AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs.
func
(
_c
*
UserCreate
)
AddAPIKeyIDs
(
ids
...
int64
)
*
UserCreate
{
_c
.
mutation
.
AddAPIKeyIDs
(
ids
...
)
...
...
@@ -440,6 +510,22 @@ func (_c *UserCreate) defaults() error {
v
:=
user
.
DefaultTotpEnabled
_c
.
mutation
.
SetTotpEnabled
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
BalanceNotifyEnabled
();
!
ok
{
v
:=
user
.
DefaultBalanceNotifyEnabled
_c
.
mutation
.
SetBalanceNotifyEnabled
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
BalanceNotifyThresholdType
();
!
ok
{
v
:=
user
.
DefaultBalanceNotifyThresholdType
_c
.
mutation
.
SetBalanceNotifyThresholdType
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
BalanceNotifyExtraEmails
();
!
ok
{
v
:=
user
.
DefaultBalanceNotifyExtraEmails
_c
.
mutation
.
SetBalanceNotifyExtraEmails
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
TotalRecharged
();
!
ok
{
v
:=
user
.
DefaultTotalRecharged
_c
.
mutation
.
SetTotalRecharged
(
v
)
}
return
nil
}
...
...
@@ -503,6 +589,18 @@ func (_c *UserCreate) check() error {
if
_
,
ok
:=
_c
.
mutation
.
TotpEnabled
();
!
ok
{
return
&
ValidationError
{
Name
:
"totp_enabled"
,
err
:
errors
.
New
(
`ent: missing required field "User.totp_enabled"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
BalanceNotifyEnabled
();
!
ok
{
return
&
ValidationError
{
Name
:
"balance_notify_enabled"
,
err
:
errors
.
New
(
`ent: missing required field "User.balance_notify_enabled"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
BalanceNotifyThresholdType
();
!
ok
{
return
&
ValidationError
{
Name
:
"balance_notify_threshold_type"
,
err
:
errors
.
New
(
`ent: missing required field "User.balance_notify_threshold_type"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
BalanceNotifyExtraEmails
();
!
ok
{
return
&
ValidationError
{
Name
:
"balance_notify_extra_emails"
,
err
:
errors
.
New
(
`ent: missing required field "User.balance_notify_extra_emails"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
TotalRecharged
();
!
ok
{
return
&
ValidationError
{
Name
:
"total_recharged"
,
err
:
errors
.
New
(
`ent: missing required field "User.total_recharged"`
)}
}
return
nil
}
...
...
@@ -586,6 +684,26 @@ func (_c *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
_spec
.
SetField
(
user
.
FieldTotpEnabledAt
,
field
.
TypeTime
,
value
)
_node
.
TotpEnabledAt
=
&
value
}
if
value
,
ok
:=
_c
.
mutation
.
BalanceNotifyEnabled
();
ok
{
_spec
.
SetField
(
user
.
FieldBalanceNotifyEnabled
,
field
.
TypeBool
,
value
)
_node
.
BalanceNotifyEnabled
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
BalanceNotifyThresholdType
();
ok
{
_spec
.
SetField
(
user
.
FieldBalanceNotifyThresholdType
,
field
.
TypeString
,
value
)
_node
.
BalanceNotifyThresholdType
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
BalanceNotifyThreshold
();
ok
{
_spec
.
SetField
(
user
.
FieldBalanceNotifyThreshold
,
field
.
TypeFloat64
,
value
)
_node
.
BalanceNotifyThreshold
=
&
value
}
if
value
,
ok
:=
_c
.
mutation
.
BalanceNotifyExtraEmails
();
ok
{
_spec
.
SetField
(
user
.
FieldBalanceNotifyExtraEmails
,
field
.
TypeString
,
value
)
_node
.
BalanceNotifyExtraEmails
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
TotalRecharged
();
ok
{
_spec
.
SetField
(
user
.
FieldTotalRecharged
,
field
.
TypeFloat64
,
value
)
_node
.
TotalRecharged
=
value
}
if
nodes
:=
_c
.
mutation
.
APIKeysIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
...
...
@@ -988,6 +1106,84 @@ func (u *UserUpsert) ClearTotpEnabledAt() *UserUpsert {
return
u
}
// SetBalanceNotifyEnabled sets the "balance_notify_enabled" field.
func
(
u
*
UserUpsert
)
SetBalanceNotifyEnabled
(
v
bool
)
*
UserUpsert
{
u
.
Set
(
user
.
FieldBalanceNotifyEnabled
,
v
)
return
u
}
// UpdateBalanceNotifyEnabled sets the "balance_notify_enabled" field to the value that was provided on create.
func
(
u
*
UserUpsert
)
UpdateBalanceNotifyEnabled
()
*
UserUpsert
{
u
.
SetExcluded
(
user
.
FieldBalanceNotifyEnabled
)
return
u
}
// SetBalanceNotifyThresholdType sets the "balance_notify_threshold_type" field.
func
(
u
*
UserUpsert
)
SetBalanceNotifyThresholdType
(
v
string
)
*
UserUpsert
{
u
.
Set
(
user
.
FieldBalanceNotifyThresholdType
,
v
)
return
u
}
// UpdateBalanceNotifyThresholdType sets the "balance_notify_threshold_type" field to the value that was provided on create.
func
(
u
*
UserUpsert
)
UpdateBalanceNotifyThresholdType
()
*
UserUpsert
{
u
.
SetExcluded
(
user
.
FieldBalanceNotifyThresholdType
)
return
u
}
// SetBalanceNotifyThreshold sets the "balance_notify_threshold" field.
func
(
u
*
UserUpsert
)
SetBalanceNotifyThreshold
(
v
float64
)
*
UserUpsert
{
u
.
Set
(
user
.
FieldBalanceNotifyThreshold
,
v
)
return
u
}
// UpdateBalanceNotifyThreshold sets the "balance_notify_threshold" field to the value that was provided on create.
func
(
u
*
UserUpsert
)
UpdateBalanceNotifyThreshold
()
*
UserUpsert
{
u
.
SetExcluded
(
user
.
FieldBalanceNotifyThreshold
)
return
u
}
// AddBalanceNotifyThreshold adds v to the "balance_notify_threshold" field.
func
(
u
*
UserUpsert
)
AddBalanceNotifyThreshold
(
v
float64
)
*
UserUpsert
{
u
.
Add
(
user
.
FieldBalanceNotifyThreshold
,
v
)
return
u
}
// ClearBalanceNotifyThreshold clears the value of the "balance_notify_threshold" field.
func
(
u
*
UserUpsert
)
ClearBalanceNotifyThreshold
()
*
UserUpsert
{
u
.
SetNull
(
user
.
FieldBalanceNotifyThreshold
)
return
u
}
// SetBalanceNotifyExtraEmails sets the "balance_notify_extra_emails" field.
func
(
u
*
UserUpsert
)
SetBalanceNotifyExtraEmails
(
v
string
)
*
UserUpsert
{
u
.
Set
(
user
.
FieldBalanceNotifyExtraEmails
,
v
)
return
u
}
// UpdateBalanceNotifyExtraEmails sets the "balance_notify_extra_emails" field to the value that was provided on create.
func
(
u
*
UserUpsert
)
UpdateBalanceNotifyExtraEmails
()
*
UserUpsert
{
u
.
SetExcluded
(
user
.
FieldBalanceNotifyExtraEmails
)
return
u
}
// SetTotalRecharged sets the "total_recharged" field.
func
(
u
*
UserUpsert
)
SetTotalRecharged
(
v
float64
)
*
UserUpsert
{
u
.
Set
(
user
.
FieldTotalRecharged
,
v
)
return
u
}
// UpdateTotalRecharged sets the "total_recharged" field to the value that was provided on create.
func
(
u
*
UserUpsert
)
UpdateTotalRecharged
()
*
UserUpsert
{
u
.
SetExcluded
(
user
.
FieldTotalRecharged
)
return
u
}
// AddTotalRecharged adds v to the "total_recharged" field.
func
(
u
*
UserUpsert
)
AddTotalRecharged
(
v
float64
)
*
UserUpsert
{
u
.
Add
(
user
.
FieldTotalRecharged
,
v
)
return
u
}
// UpdateNewValues updates the mutable fields using the new values that were set on create.
// Using this option is equivalent to using:
//
...
...
@@ -1250,6 +1446,97 @@ func (u *UserUpsertOne) ClearTotpEnabledAt() *UserUpsertOne {
})
}
// SetBalanceNotifyEnabled sets the "balance_notify_enabled" field.
func
(
u
*
UserUpsertOne
)
SetBalanceNotifyEnabled
(
v
bool
)
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
SetBalanceNotifyEnabled
(
v
)
})
}
// UpdateBalanceNotifyEnabled sets the "balance_notify_enabled" field to the value that was provided on create.
func
(
u
*
UserUpsertOne
)
UpdateBalanceNotifyEnabled
()
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
UpdateBalanceNotifyEnabled
()
})
}
// SetBalanceNotifyThresholdType sets the "balance_notify_threshold_type" field.
func
(
u
*
UserUpsertOne
)
SetBalanceNotifyThresholdType
(
v
string
)
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
SetBalanceNotifyThresholdType
(
v
)
})
}
// UpdateBalanceNotifyThresholdType sets the "balance_notify_threshold_type" field to the value that was provided on create.
func
(
u
*
UserUpsertOne
)
UpdateBalanceNotifyThresholdType
()
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
UpdateBalanceNotifyThresholdType
()
})
}
// SetBalanceNotifyThreshold sets the "balance_notify_threshold" field.
func
(
u
*
UserUpsertOne
)
SetBalanceNotifyThreshold
(
v
float64
)
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
SetBalanceNotifyThreshold
(
v
)
})
}
// AddBalanceNotifyThreshold adds v to the "balance_notify_threshold" field.
func
(
u
*
UserUpsertOne
)
AddBalanceNotifyThreshold
(
v
float64
)
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
AddBalanceNotifyThreshold
(
v
)
})
}
// UpdateBalanceNotifyThreshold sets the "balance_notify_threshold" field to the value that was provided on create.
func
(
u
*
UserUpsertOne
)
UpdateBalanceNotifyThreshold
()
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
UpdateBalanceNotifyThreshold
()
})
}
// ClearBalanceNotifyThreshold clears the value of the "balance_notify_threshold" field.
func
(
u
*
UserUpsertOne
)
ClearBalanceNotifyThreshold
()
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
ClearBalanceNotifyThreshold
()
})
}
// SetBalanceNotifyExtraEmails sets the "balance_notify_extra_emails" field.
func
(
u
*
UserUpsertOne
)
SetBalanceNotifyExtraEmails
(
v
string
)
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
SetBalanceNotifyExtraEmails
(
v
)
})
}
// UpdateBalanceNotifyExtraEmails sets the "balance_notify_extra_emails" field to the value that was provided on create.
func
(
u
*
UserUpsertOne
)
UpdateBalanceNotifyExtraEmails
()
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
UpdateBalanceNotifyExtraEmails
()
})
}
// SetTotalRecharged sets the "total_recharged" field.
func
(
u
*
UserUpsertOne
)
SetTotalRecharged
(
v
float64
)
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
SetTotalRecharged
(
v
)
})
}
// AddTotalRecharged adds v to the "total_recharged" field.
func
(
u
*
UserUpsertOne
)
AddTotalRecharged
(
v
float64
)
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
AddTotalRecharged
(
v
)
})
}
// UpdateTotalRecharged sets the "total_recharged" field to the value that was provided on create.
func
(
u
*
UserUpsertOne
)
UpdateTotalRecharged
()
*
UserUpsertOne
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
UpdateTotalRecharged
()
})
}
// Exec executes the query.
func
(
u
*
UserUpsertOne
)
Exec
(
ctx
context
.
Context
)
error
{
if
len
(
u
.
create
.
conflict
)
==
0
{
...
...
@@ -1678,6 +1965,97 @@ func (u *UserUpsertBulk) ClearTotpEnabledAt() *UserUpsertBulk {
})
}
// SetBalanceNotifyEnabled sets the "balance_notify_enabled" field.
func
(
u
*
UserUpsertBulk
)
SetBalanceNotifyEnabled
(
v
bool
)
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
SetBalanceNotifyEnabled
(
v
)
})
}
// UpdateBalanceNotifyEnabled sets the "balance_notify_enabled" field to the value that was provided on create.
func
(
u
*
UserUpsertBulk
)
UpdateBalanceNotifyEnabled
()
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
UpdateBalanceNotifyEnabled
()
})
}
// SetBalanceNotifyThresholdType sets the "balance_notify_threshold_type" field.
func
(
u
*
UserUpsertBulk
)
SetBalanceNotifyThresholdType
(
v
string
)
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
SetBalanceNotifyThresholdType
(
v
)
})
}
// UpdateBalanceNotifyThresholdType sets the "balance_notify_threshold_type" field to the value that was provided on create.
func
(
u
*
UserUpsertBulk
)
UpdateBalanceNotifyThresholdType
()
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
UpdateBalanceNotifyThresholdType
()
})
}
// SetBalanceNotifyThreshold sets the "balance_notify_threshold" field.
func
(
u
*
UserUpsertBulk
)
SetBalanceNotifyThreshold
(
v
float64
)
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
SetBalanceNotifyThreshold
(
v
)
})
}
// AddBalanceNotifyThreshold adds v to the "balance_notify_threshold" field.
func
(
u
*
UserUpsertBulk
)
AddBalanceNotifyThreshold
(
v
float64
)
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
AddBalanceNotifyThreshold
(
v
)
})
}
// UpdateBalanceNotifyThreshold sets the "balance_notify_threshold" field to the value that was provided on create.
func
(
u
*
UserUpsertBulk
)
UpdateBalanceNotifyThreshold
()
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
UpdateBalanceNotifyThreshold
()
})
}
// ClearBalanceNotifyThreshold clears the value of the "balance_notify_threshold" field.
func
(
u
*
UserUpsertBulk
)
ClearBalanceNotifyThreshold
()
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
ClearBalanceNotifyThreshold
()
})
}
// SetBalanceNotifyExtraEmails sets the "balance_notify_extra_emails" field.
func
(
u
*
UserUpsertBulk
)
SetBalanceNotifyExtraEmails
(
v
string
)
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
SetBalanceNotifyExtraEmails
(
v
)
})
}
// UpdateBalanceNotifyExtraEmails sets the "balance_notify_extra_emails" field to the value that was provided on create.
func
(
u
*
UserUpsertBulk
)
UpdateBalanceNotifyExtraEmails
()
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
UpdateBalanceNotifyExtraEmails
()
})
}
// SetTotalRecharged sets the "total_recharged" field.
func
(
u
*
UserUpsertBulk
)
SetTotalRecharged
(
v
float64
)
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
SetTotalRecharged
(
v
)
})
}
// AddTotalRecharged adds v to the "total_recharged" field.
func
(
u
*
UserUpsertBulk
)
AddTotalRecharged
(
v
float64
)
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
AddTotalRecharged
(
v
)
})
}
// UpdateTotalRecharged sets the "total_recharged" field to the value that was provided on create.
func
(
u
*
UserUpsertBulk
)
UpdateTotalRecharged
()
*
UserUpsertBulk
{
return
u
.
Update
(
func
(
s
*
UserUpsert
)
{
s
.
UpdateTotalRecharged
()
})
}
// Exec executes the query.
func
(
u
*
UserUpsertBulk
)
Exec
(
ctx
context
.
Context
)
error
{
if
u
.
create
.
err
!=
nil
{
...
...
backend/ent/user_update.go
View file @
0b746501
...
...
@@ -243,6 +243,96 @@ func (_u *UserUpdate) ClearTotpEnabledAt() *UserUpdate {
return
_u
}
// SetBalanceNotifyEnabled sets the "balance_notify_enabled" field.
func
(
_u
*
UserUpdate
)
SetBalanceNotifyEnabled
(
v
bool
)
*
UserUpdate
{
_u
.
mutation
.
SetBalanceNotifyEnabled
(
v
)
return
_u
}
// SetNillableBalanceNotifyEnabled sets the "balance_notify_enabled" field if the given value is not nil.
func
(
_u
*
UserUpdate
)
SetNillableBalanceNotifyEnabled
(
v
*
bool
)
*
UserUpdate
{
if
v
!=
nil
{
_u
.
SetBalanceNotifyEnabled
(
*
v
)
}
return
_u
}
// SetBalanceNotifyThresholdType sets the "balance_notify_threshold_type" field.
func
(
_u
*
UserUpdate
)
SetBalanceNotifyThresholdType
(
v
string
)
*
UserUpdate
{
_u
.
mutation
.
SetBalanceNotifyThresholdType
(
v
)
return
_u
}
// SetNillableBalanceNotifyThresholdType sets the "balance_notify_threshold_type" field if the given value is not nil.
func
(
_u
*
UserUpdate
)
SetNillableBalanceNotifyThresholdType
(
v
*
string
)
*
UserUpdate
{
if
v
!=
nil
{
_u
.
SetBalanceNotifyThresholdType
(
*
v
)
}
return
_u
}
// SetBalanceNotifyThreshold sets the "balance_notify_threshold" field.
func
(
_u
*
UserUpdate
)
SetBalanceNotifyThreshold
(
v
float64
)
*
UserUpdate
{
_u
.
mutation
.
ResetBalanceNotifyThreshold
()
_u
.
mutation
.
SetBalanceNotifyThreshold
(
v
)
return
_u
}
// SetNillableBalanceNotifyThreshold sets the "balance_notify_threshold" field if the given value is not nil.
func
(
_u
*
UserUpdate
)
SetNillableBalanceNotifyThreshold
(
v
*
float64
)
*
UserUpdate
{
if
v
!=
nil
{
_u
.
SetBalanceNotifyThreshold
(
*
v
)
}
return
_u
}
// AddBalanceNotifyThreshold adds value to the "balance_notify_threshold" field.
func
(
_u
*
UserUpdate
)
AddBalanceNotifyThreshold
(
v
float64
)
*
UserUpdate
{
_u
.
mutation
.
AddBalanceNotifyThreshold
(
v
)
return
_u
}
// ClearBalanceNotifyThreshold clears the value of the "balance_notify_threshold" field.
func
(
_u
*
UserUpdate
)
ClearBalanceNotifyThreshold
()
*
UserUpdate
{
_u
.
mutation
.
ClearBalanceNotifyThreshold
()
return
_u
}
// SetBalanceNotifyExtraEmails sets the "balance_notify_extra_emails" field.
func
(
_u
*
UserUpdate
)
SetBalanceNotifyExtraEmails
(
v
string
)
*
UserUpdate
{
_u
.
mutation
.
SetBalanceNotifyExtraEmails
(
v
)
return
_u
}
// SetNillableBalanceNotifyExtraEmails sets the "balance_notify_extra_emails" field if the given value is not nil.
func
(
_u
*
UserUpdate
)
SetNillableBalanceNotifyExtraEmails
(
v
*
string
)
*
UserUpdate
{
if
v
!=
nil
{
_u
.
SetBalanceNotifyExtraEmails
(
*
v
)
}
return
_u
}
// SetTotalRecharged sets the "total_recharged" field.
func
(
_u
*
UserUpdate
)
SetTotalRecharged
(
v
float64
)
*
UserUpdate
{
_u
.
mutation
.
ResetTotalRecharged
()
_u
.
mutation
.
SetTotalRecharged
(
v
)
return
_u
}
// SetNillableTotalRecharged sets the "total_recharged" field if the given value is not nil.
func
(
_u
*
UserUpdate
)
SetNillableTotalRecharged
(
v
*
float64
)
*
UserUpdate
{
if
v
!=
nil
{
_u
.
SetTotalRecharged
(
*
v
)
}
return
_u
}
// AddTotalRecharged adds value to the "total_recharged" field.
func
(
_u
*
UserUpdate
)
AddTotalRecharged
(
v
float64
)
*
UserUpdate
{
_u
.
mutation
.
AddTotalRecharged
(
v
)
return
_u
}
// AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs.
func
(
_u
*
UserUpdate
)
AddAPIKeyIDs
(
ids
...
int64
)
*
UserUpdate
{
_u
.
mutation
.
AddAPIKeyIDs
(
ids
...
)
...
...
@@ -746,6 +836,30 @@ func (_u *UserUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if
_u
.
mutation
.
TotpEnabledAtCleared
()
{
_spec
.
ClearField
(
user
.
FieldTotpEnabledAt
,
field
.
TypeTime
)
}
if
value
,
ok
:=
_u
.
mutation
.
BalanceNotifyEnabled
();
ok
{
_spec
.
SetField
(
user
.
FieldBalanceNotifyEnabled
,
field
.
TypeBool
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
BalanceNotifyThresholdType
();
ok
{
_spec
.
SetField
(
user
.
FieldBalanceNotifyThresholdType
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
BalanceNotifyThreshold
();
ok
{
_spec
.
SetField
(
user
.
FieldBalanceNotifyThreshold
,
field
.
TypeFloat64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedBalanceNotifyThreshold
();
ok
{
_spec
.
AddField
(
user
.
FieldBalanceNotifyThreshold
,
field
.
TypeFloat64
,
value
)
}
if
_u
.
mutation
.
BalanceNotifyThresholdCleared
()
{
_spec
.
ClearField
(
user
.
FieldBalanceNotifyThreshold
,
field
.
TypeFloat64
)
}
if
value
,
ok
:=
_u
.
mutation
.
BalanceNotifyExtraEmails
();
ok
{
_spec
.
SetField
(
user
.
FieldBalanceNotifyExtraEmails
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
TotalRecharged
();
ok
{
_spec
.
SetField
(
user
.
FieldTotalRecharged
,
field
.
TypeFloat64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedTotalRecharged
();
ok
{
_spec
.
AddField
(
user
.
FieldTotalRecharged
,
field
.
TypeFloat64
,
value
)
}
if
_u
.
mutation
.
APIKeysCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
...
...
@@ -1434,6 +1548,96 @@ func (_u *UserUpdateOne) ClearTotpEnabledAt() *UserUpdateOne {
return
_u
}
// SetBalanceNotifyEnabled sets the "balance_notify_enabled" field.
func
(
_u
*
UserUpdateOne
)
SetBalanceNotifyEnabled
(
v
bool
)
*
UserUpdateOne
{
_u
.
mutation
.
SetBalanceNotifyEnabled
(
v
)
return
_u
}
// SetNillableBalanceNotifyEnabled sets the "balance_notify_enabled" field if the given value is not nil.
func
(
_u
*
UserUpdateOne
)
SetNillableBalanceNotifyEnabled
(
v
*
bool
)
*
UserUpdateOne
{
if
v
!=
nil
{
_u
.
SetBalanceNotifyEnabled
(
*
v
)
}
return
_u
}
// SetBalanceNotifyThresholdType sets the "balance_notify_threshold_type" field.
func
(
_u
*
UserUpdateOne
)
SetBalanceNotifyThresholdType
(
v
string
)
*
UserUpdateOne
{
_u
.
mutation
.
SetBalanceNotifyThresholdType
(
v
)
return
_u
}
// SetNillableBalanceNotifyThresholdType sets the "balance_notify_threshold_type" field if the given value is not nil.
func
(
_u
*
UserUpdateOne
)
SetNillableBalanceNotifyThresholdType
(
v
*
string
)
*
UserUpdateOne
{
if
v
!=
nil
{
_u
.
SetBalanceNotifyThresholdType
(
*
v
)
}
return
_u
}
// SetBalanceNotifyThreshold sets the "balance_notify_threshold" field.
func
(
_u
*
UserUpdateOne
)
SetBalanceNotifyThreshold
(
v
float64
)
*
UserUpdateOne
{
_u
.
mutation
.
ResetBalanceNotifyThreshold
()
_u
.
mutation
.
SetBalanceNotifyThreshold
(
v
)
return
_u
}
// SetNillableBalanceNotifyThreshold sets the "balance_notify_threshold" field if the given value is not nil.
func
(
_u
*
UserUpdateOne
)
SetNillableBalanceNotifyThreshold
(
v
*
float64
)
*
UserUpdateOne
{
if
v
!=
nil
{
_u
.
SetBalanceNotifyThreshold
(
*
v
)
}
return
_u
}
// AddBalanceNotifyThreshold adds value to the "balance_notify_threshold" field.
func
(
_u
*
UserUpdateOne
)
AddBalanceNotifyThreshold
(
v
float64
)
*
UserUpdateOne
{
_u
.
mutation
.
AddBalanceNotifyThreshold
(
v
)
return
_u
}
// ClearBalanceNotifyThreshold clears the value of the "balance_notify_threshold" field.
func
(
_u
*
UserUpdateOne
)
ClearBalanceNotifyThreshold
()
*
UserUpdateOne
{
_u
.
mutation
.
ClearBalanceNotifyThreshold
()
return
_u
}
// SetBalanceNotifyExtraEmails sets the "balance_notify_extra_emails" field.
func
(
_u
*
UserUpdateOne
)
SetBalanceNotifyExtraEmails
(
v
string
)
*
UserUpdateOne
{
_u
.
mutation
.
SetBalanceNotifyExtraEmails
(
v
)
return
_u
}
// SetNillableBalanceNotifyExtraEmails sets the "balance_notify_extra_emails" field if the given value is not nil.
func
(
_u
*
UserUpdateOne
)
SetNillableBalanceNotifyExtraEmails
(
v
*
string
)
*
UserUpdateOne
{
if
v
!=
nil
{
_u
.
SetBalanceNotifyExtraEmails
(
*
v
)
}
return
_u
}
// SetTotalRecharged sets the "total_recharged" field.
func
(
_u
*
UserUpdateOne
)
SetTotalRecharged
(
v
float64
)
*
UserUpdateOne
{
_u
.
mutation
.
ResetTotalRecharged
()
_u
.
mutation
.
SetTotalRecharged
(
v
)
return
_u
}
// SetNillableTotalRecharged sets the "total_recharged" field if the given value is not nil.
func
(
_u
*
UserUpdateOne
)
SetNillableTotalRecharged
(
v
*
float64
)
*
UserUpdateOne
{
if
v
!=
nil
{
_u
.
SetTotalRecharged
(
*
v
)
}
return
_u
}
// AddTotalRecharged adds value to the "total_recharged" field.
func
(
_u
*
UserUpdateOne
)
AddTotalRecharged
(
v
float64
)
*
UserUpdateOne
{
_u
.
mutation
.
AddTotalRecharged
(
v
)
return
_u
}
// AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs.
func
(
_u
*
UserUpdateOne
)
AddAPIKeyIDs
(
ids
...
int64
)
*
UserUpdateOne
{
_u
.
mutation
.
AddAPIKeyIDs
(
ids
...
)
...
...
@@ -1967,6 +2171,30 @@ func (_u *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) {
if
_u
.
mutation
.
TotpEnabledAtCleared
()
{
_spec
.
ClearField
(
user
.
FieldTotpEnabledAt
,
field
.
TypeTime
)
}
if
value
,
ok
:=
_u
.
mutation
.
BalanceNotifyEnabled
();
ok
{
_spec
.
SetField
(
user
.
FieldBalanceNotifyEnabled
,
field
.
TypeBool
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
BalanceNotifyThresholdType
();
ok
{
_spec
.
SetField
(
user
.
FieldBalanceNotifyThresholdType
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
BalanceNotifyThreshold
();
ok
{
_spec
.
SetField
(
user
.
FieldBalanceNotifyThreshold
,
field
.
TypeFloat64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedBalanceNotifyThreshold
();
ok
{
_spec
.
AddField
(
user
.
FieldBalanceNotifyThreshold
,
field
.
TypeFloat64
,
value
)
}
if
_u
.
mutation
.
BalanceNotifyThresholdCleared
()
{
_spec
.
ClearField
(
user
.
FieldBalanceNotifyThreshold
,
field
.
TypeFloat64
)
}
if
value
,
ok
:=
_u
.
mutation
.
BalanceNotifyExtraEmails
();
ok
{
_spec
.
SetField
(
user
.
FieldBalanceNotifyExtraEmails
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
TotalRecharged
();
ok
{
_spec
.
SetField
(
user
.
FieldTotalRecharged
,
field
.
TypeFloat64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedTotalRecharged
();
ok
{
_spec
.
AddField
(
user
.
FieldTotalRecharged
,
field
.
TypeFloat64
,
value
)
}
if
_u
.
mutation
.
APIKeysCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
...
...
Prev
1
2
3
4
5
…
12
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment