Prep for reactions, some fixes and improvements
Some checks failed
/ docker (push) Failing after 1m35s

This commit is contained in:
Melody Becker 2025-06-16 08:13:11 +02:00
parent 4b62c32247
commit 8947d97825
Signed by: mstar
SSH key fingerprint: SHA256:vkXfS9FG2pVNVfvDrzd1VW9n8VJzqqdKQGljxxX8uK8
13 changed files with 262 additions and 43 deletions

View file

@ -27,13 +27,14 @@ func newReaction(db *gorm.DB, opts ...gen.DOOption) reaction {
tableName := _reaction.reactionDo.TableName()
_reaction.ALL = field.NewAsterisk(tableName)
_reaction.ID = field.NewUint(tableName, "id")
_reaction.ID = field.NewString(tableName, "id")
_reaction.CreatedAt = field.NewTime(tableName, "created_at")
_reaction.UpdatedAt = field.NewTime(tableName, "updated_at")
_reaction.DeletedAt = field.NewField(tableName, "deleted_at")
_reaction.NoteId = field.NewString(tableName, "note_id")
_reaction.ReactorId = field.NewString(tableName, "reactor_id")
_reaction.EmoteId = field.NewField(tableName, "emote_id")
_reaction.Content = field.NewField(tableName, "content")
_reaction.Note = reactionBelongsToNote{
db: db.Session(&gorm.Session{}),
@ -424,13 +425,14 @@ type reaction struct {
reactionDo
ALL field.Asterisk
ID field.Uint
ID field.String
CreatedAt field.Time
UpdatedAt field.Time
DeletedAt field.Field
NoteId field.String
ReactorId field.String
EmoteId field.Field
Content field.Field
Note reactionBelongsToNote
Reactor reactionBelongsToReactor
@ -452,13 +454,14 @@ func (r reaction) As(alias string) *reaction {
func (r *reaction) updateTableName(table string) *reaction {
r.ALL = field.NewAsterisk(table)
r.ID = field.NewUint(table, "id")
r.ID = field.NewString(table, "id")
r.CreatedAt = field.NewTime(table, "created_at")
r.UpdatedAt = field.NewTime(table, "updated_at")
r.DeletedAt = field.NewField(table, "deleted_at")
r.NoteId = field.NewString(table, "note_id")
r.ReactorId = field.NewString(table, "reactor_id")
r.EmoteId = field.NewField(table, "emote_id")
r.Content = field.NewField(table, "content")
r.fillFieldMap()
@ -475,7 +478,7 @@ func (r *reaction) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
}
func (r *reaction) fillFieldMap() {
r.fieldMap = make(map[string]field.Expr, 10)
r.fieldMap = make(map[string]field.Expr, 11)
r.fieldMap["id"] = r.ID
r.fieldMap["created_at"] = r.CreatedAt
r.fieldMap["updated_at"] = r.UpdatedAt
@ -483,6 +486,7 @@ func (r *reaction) fillFieldMap() {
r.fieldMap["note_id"] = r.NoteId
r.fieldMap["reactor_id"] = r.ReactorId
r.fieldMap["emote_id"] = r.EmoteId
r.fieldMap["content"] = r.Content
}