From 3512c7be4f013258c1624bc9b9a842d7031077f6 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Sat, 8 Oct 2022 19:13:39 +0200 Subject: [PATCH] Reactions: Ignore error, should a test fixture already exist Signed-off-by: Michael Mayer --- internal/entity/reaction_fixtures.go | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/internal/entity/reaction_fixtures.go b/internal/entity/reaction_fixtures.go index 14ef27ba2..24856443e 100644 --- a/internal/entity/reaction_fixtures.go +++ b/internal/entity/reaction_fixtures.go @@ -22,27 +22,31 @@ func (m ReactionMap) Pointer(name string) *Reaction { var ReactionFixtures = ReactionMap{ "SubjectJohnLike": Reaction{ - UID: SubjectFixtures.Get("john-doe").SubjUID, - UserUID: UserFixtures.Get("alice").UserUID, - Reaction: react.Like.String(), + UID: SubjectFixtures.Get("john-doe").SubjUID, + UserUID: UserFixtures.Get("alice").UserUID, + Reaction: react.Like.String(), + Reacted: 1, + ReactedAt: TimePointer(), }, "PhotoAliceLove": Reaction{ - UID: PhotoFixtures.Get("Photo01").PhotoUID, - UserUID: UserFixtures.Pointer("alice").UserUID, - Reaction: react.Love.String(), + UID: PhotoFixtures.Get("Photo01").PhotoUID, + UserUID: UserFixtures.Pointer("alice").UserUID, + Reaction: react.Love.String(), + Reacted: 3, + ReactedAt: TimePointer(), }, "PhotoBobLove": Reaction{ - UID: PhotoFixtures.Get("Photo01").PhotoUID, - UserUID: UserFixtures.Pointer("bob").UserUID, - Reaction: react.Love.String(), + UID: PhotoFixtures.Get("Photo01").PhotoUID, + UserUID: UserFixtures.Pointer("bob").UserUID, + Reaction: react.Love.String(), + Reacted: 1, + ReactedAt: TimePointer(), }, } // CreateReactionFixtures inserts known entities into the database for testing. func CreateReactionFixtures() { for _, entity := range ReactionFixtures { - if err := entity.Create(); err != nil { - log.Error(err) - } + Db().Create(&entity) } }