Browse Source

fix comments create/update not applying character name.

master 2.2.3
Gisle Aune 10 months ago
parent
commit
87559997a9
  1. 5
      database/postgres/comments.go
  2. 1
      database/postgres/queries/comments.sql
  3. 1
      models/comment.go

5
database/postgres/comments.go

@ -53,7 +53,7 @@ func (r *commentRepository) Insert(ctx context.Context, comment models.Comment)
CharacterID: comment.CharacterID,
Subject: comment.Subject,
Author: comment.Author,
CharacterName: comment.CharacterID,
CharacterName: comment.CharacterName,
Source: comment.Source,
CreatedDate: comment.CreatedDate.UTC(),
FictionalDate: comment.FictionalDate.UTC(),
@ -73,7 +73,8 @@ func (r *commentRepository) Update(ctx context.Context, comment models.Comment,
Subject: comment.Subject,
Source: comment.Source,
FictionalDate: comment.FictionalDate.UTC(),
CharacterName: comment.ChapterID,
EditedDate: comment.EditedDate.UTC(),
CharacterName: comment.CharacterName,
CharacterID: comment.CharacterID,
ID: comment.ID,
})

1
database/postgres/queries/comments.sql

@ -14,6 +14,7 @@ UPDATE story_comment
SET subject = @subject,
source = @source,
fictional_date = @fictional_date,
edited_date = @edited_date,
character_name = @character_name,
character_id = @character_id
WHERE id = @id;

1
models/comment.go

@ -32,6 +32,7 @@ func (comment *Comment) ApplyUpdate(update CommentUpdate) {
if update.FictionalDate != nil {
comment.FictionalDate = *update.FictionalDate
}
comment.EditedDate = time.Now()
}
// IsChangeObject is an interface implementation to identify it as a valid

Loading…
Cancel
Save