Fix gorm gen being not good with typing
Some checks are pending
/ test (push) Waiting to run

This commit is contained in:
Melody Becker 2025-04-04 13:50:42 +02:00
parent b33f6c2af7
commit d33ed051f4
Signed by: mstar
SSH key fingerprint: SHA256:9VAo09aaVNTWKzPW7Hq2LW+ox9OdwmTSHRoD4mlz1yI
2 changed files with 7 additions and 5 deletions

View file

@ -778,14 +778,15 @@ type INotificationDo interface {
UnderlyingDB() *gorm.DB UnderlyingDB() *gorm.DB
schema.Tabler schema.Tabler
SetState(state NotificationViewedState, ids []uint) (err error) SetState(state uint8, ids []uint) (err error)
GetLatestWithOffset(userId string, count uint, offset uint) (result []models.Notification, err error) GetLatestWithOffset(userId string, count uint, offset uint) (result []models.Notification, err error)
} }
// Update a given set of notifications to a given viewed state // Update a given set of notifications to a given viewed state.
// State should be a [NotificationViewedStateType]
// //
// UPDATE @@table SET viewed_state = @state WHERE id IN @id // UPDATE @@table SET viewed_state = @state WHERE id IN @id
func (n notificationDo) SetState(state NotificationViewedState, ids []uint) (err error) { func (n notificationDo) SetState(state uint8, ids []uint) (err error) {
var params []interface{} var params []interface{}
var generateSQL strings.Builder var generateSQL strings.Builder

View file

@ -22,10 +22,11 @@ type Notification struct {
} }
type INotification interface { type INotification interface {
// Update a given set of notifications to a given viewed state // Update a given set of notifications to a given viewed state.
// State should be a [NotificationViewedStateType]
// //
// UPDATE @@table SET viewed_state = @state WHERE id IN @id // UPDATE @@table SET viewed_state = @state WHERE id IN @id
SetState(state NotificationViewedState, ids ...uint) error SetState(state uint8, ids ...uint) error
// Get the lastest count amount of notifications with a given offset for a user // Get the lastest count amount of notifications with a given offset for a user
// //