feat: add audit logs and system configs
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
|
||||
var (
|
||||
Q = new(Query)
|
||||
AuditLogQuery *auditLogQuery
|
||||
CommentQuery *commentQuery
|
||||
ContentQuery *contentQuery
|
||||
ContentAccessQuery *contentAccessQuery
|
||||
@@ -29,6 +30,7 @@ var (
|
||||
OrderQuery *orderQuery
|
||||
OrderItemQuery *orderItemQuery
|
||||
PayoutAccountQuery *payoutAccountQuery
|
||||
SystemConfigQuery *systemConfigQuery
|
||||
TenantQuery *tenantQuery
|
||||
TenantInviteQuery *tenantInviteQuery
|
||||
TenantJoinRequestQuery *tenantJoinRequestQuery
|
||||
@@ -42,6 +44,7 @@ var (
|
||||
|
||||
func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||
*Q = *Use(db, opts...)
|
||||
AuditLogQuery = &Q.AuditLog
|
||||
CommentQuery = &Q.Comment
|
||||
ContentQuery = &Q.Content
|
||||
ContentAccessQuery = &Q.ContentAccess
|
||||
@@ -54,6 +57,7 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||
OrderQuery = &Q.Order
|
||||
OrderItemQuery = &Q.OrderItem
|
||||
PayoutAccountQuery = &Q.PayoutAccount
|
||||
SystemConfigQuery = &Q.SystemConfig
|
||||
TenantQuery = &Q.Tenant
|
||||
TenantInviteQuery = &Q.TenantInvite
|
||||
TenantJoinRequestQuery = &Q.TenantJoinRequest
|
||||
@@ -68,6 +72,7 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||
func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AuditLog: newAuditLog(db, opts...),
|
||||
Comment: newComment(db, opts...),
|
||||
Content: newContent(db, opts...),
|
||||
ContentAccess: newContentAccess(db, opts...),
|
||||
@@ -80,6 +85,7 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
Order: newOrder(db, opts...),
|
||||
OrderItem: newOrderItem(db, opts...),
|
||||
PayoutAccount: newPayoutAccount(db, opts...),
|
||||
SystemConfig: newSystemConfig(db, opts...),
|
||||
Tenant: newTenant(db, opts...),
|
||||
TenantInvite: newTenantInvite(db, opts...),
|
||||
TenantJoinRequest: newTenantJoinRequest(db, opts...),
|
||||
@@ -95,6 +101,7 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
type Query struct {
|
||||
db *gorm.DB
|
||||
|
||||
AuditLog auditLogQuery
|
||||
Comment commentQuery
|
||||
Content contentQuery
|
||||
ContentAccess contentAccessQuery
|
||||
@@ -107,6 +114,7 @@ type Query struct {
|
||||
Order orderQuery
|
||||
OrderItem orderItemQuery
|
||||
PayoutAccount payoutAccountQuery
|
||||
SystemConfig systemConfigQuery
|
||||
Tenant tenantQuery
|
||||
TenantInvite tenantInviteQuery
|
||||
TenantJoinRequest tenantJoinRequestQuery
|
||||
@@ -123,6 +131,7 @@ func (q *Query) Available() bool { return q.db != nil }
|
||||
func (q *Query) clone(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AuditLog: q.AuditLog.clone(db),
|
||||
Comment: q.Comment.clone(db),
|
||||
Content: q.Content.clone(db),
|
||||
ContentAccess: q.ContentAccess.clone(db),
|
||||
@@ -135,6 +144,7 @@ func (q *Query) clone(db *gorm.DB) *Query {
|
||||
Order: q.Order.clone(db),
|
||||
OrderItem: q.OrderItem.clone(db),
|
||||
PayoutAccount: q.PayoutAccount.clone(db),
|
||||
SystemConfig: q.SystemConfig.clone(db),
|
||||
Tenant: q.Tenant.clone(db),
|
||||
TenantInvite: q.TenantInvite.clone(db),
|
||||
TenantJoinRequest: q.TenantJoinRequest.clone(db),
|
||||
@@ -158,6 +168,7 @@ func (q *Query) WriteDB() *Query {
|
||||
func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AuditLog: q.AuditLog.replaceDB(db),
|
||||
Comment: q.Comment.replaceDB(db),
|
||||
Content: q.Content.replaceDB(db),
|
||||
ContentAccess: q.ContentAccess.replaceDB(db),
|
||||
@@ -170,6 +181,7 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
Order: q.Order.replaceDB(db),
|
||||
OrderItem: q.OrderItem.replaceDB(db),
|
||||
PayoutAccount: q.PayoutAccount.replaceDB(db),
|
||||
SystemConfig: q.SystemConfig.replaceDB(db),
|
||||
Tenant: q.Tenant.replaceDB(db),
|
||||
TenantInvite: q.TenantInvite.replaceDB(db),
|
||||
TenantJoinRequest: q.TenantJoinRequest.replaceDB(db),
|
||||
@@ -183,6 +195,7 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
}
|
||||
|
||||
type queryCtx struct {
|
||||
AuditLog *auditLogQueryDo
|
||||
Comment *commentQueryDo
|
||||
Content *contentQueryDo
|
||||
ContentAccess *contentAccessQueryDo
|
||||
@@ -195,6 +208,7 @@ type queryCtx struct {
|
||||
Order *orderQueryDo
|
||||
OrderItem *orderItemQueryDo
|
||||
PayoutAccount *payoutAccountQueryDo
|
||||
SystemConfig *systemConfigQueryDo
|
||||
Tenant *tenantQueryDo
|
||||
TenantInvite *tenantInviteQueryDo
|
||||
TenantJoinRequest *tenantJoinRequestQueryDo
|
||||
@@ -208,6 +222,7 @@ type queryCtx struct {
|
||||
|
||||
func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
return &queryCtx{
|
||||
AuditLog: q.AuditLog.WithContext(ctx),
|
||||
Comment: q.Comment.WithContext(ctx),
|
||||
Content: q.Content.WithContext(ctx),
|
||||
ContentAccess: q.ContentAccess.WithContext(ctx),
|
||||
@@ -220,6 +235,7 @@ func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
Order: q.Order.WithContext(ctx),
|
||||
OrderItem: q.OrderItem.WithContext(ctx),
|
||||
PayoutAccount: q.PayoutAccount.WithContext(ctx),
|
||||
SystemConfig: q.SystemConfig.WithContext(ctx),
|
||||
Tenant: q.Tenant.WithContext(ctx),
|
||||
TenantInvite: q.TenantInvite.WithContext(ctx),
|
||||
TenantJoinRequest: q.TenantJoinRequest.WithContext(ctx),
|
||||
|
||||
Reference in New Issue
Block a user