Skip to content

Commit ca2f593

Browse files
authored
Merge pull request #296 from ErikKalkoken/feat-notify-duplicates
feat: sent same notifications once only
2 parents f3651d9 + 30560e1 commit ca2f593

39 files changed

+587
-426
lines changed

internal/app/characterservice/communications.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (s *CharacterService) NotifyCommunications(ctx context.Context, characterID
4747
}
4848
title, content := s.RenderNotificationSummary(n)
4949
notify(title, content)
50-
if err := s.st.UpdateCharacterNotificationSetProcessed(ctx, n.ID); err != nil {
50+
if err := s.st.UpdateCharacterNotificationsSetProcessed(ctx, n.NotificationID); err != nil {
5151
return nil, err
5252
}
5353
}

internal/app/eveuniverseservice/location_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const (
2222
)
2323

2424
func TestEveLocation(t *testing.T) {
25-
db, r, factory := testutil.NewDBInMemory()
25+
db, st, factory := testutil.NewDBInMemory()
2626
defer db.Close()
2727
httpmock.Activate()
2828
defer httpmock.DeactivateAndReset()
29-
s := eveuniverseservice.NewTestService(r)
29+
s := eveuniverseservice.NewTestService(st)
3030
ctx := context.Background()
3131
t.Run("should create location for a station", func(t *testing.T) {
3232
// given
@@ -79,7 +79,7 @@ func TestEveLocation(t *testing.T) {
7979
assert.Equal(t, owner, x1.Owner)
8080
assert.Equal(t, system, x1.SolarSystem)
8181
assert.Equal(t, myType, x1.Type)
82-
x2, err := r.GetLocation(ctx, stationID)
82+
x2, err := st.GetLocation(ctx, stationID)
8383
if assert.NoError(t, err) {
8484
assert.Equal(t, x1, x2)
8585
}
@@ -100,7 +100,7 @@ func TestEveLocation(t *testing.T) {
100100
assert.Nil(t, x1.Owner)
101101
assert.Equal(t, system, x1.SolarSystem)
102102
assert.Equal(t, myType, x1.Type)
103-
x2, err := r.GetLocation(ctx, int64(system.ID))
103+
x2, err := st.GetLocation(ctx, int64(system.ID))
104104
if assert.NoError(t, err) {
105105
assert.Equal(t, x1, x2)
106106
}
@@ -116,7 +116,7 @@ func TestEveLocation(t *testing.T) {
116116
// then
117117
if assert.NoError(t, err) {
118118
assert.Equal(t, myType, x1.Type)
119-
x2, err := r.GetLocation(ctx, x1.ID)
119+
x2, err := st.GetLocation(ctx, x1.ID)
120120
if assert.NoError(t, err) {
121121
assert.Equal(t, x1, x2)
122122
}
@@ -132,7 +132,7 @@ func TestEveLocation(t *testing.T) {
132132
// then
133133
if assert.NoError(t, err) {
134134
assert.Equal(t, myType, x1.Type)
135-
x2, err := r.GetLocation(ctx, x1.ID)
135+
x2, err := st.GetLocation(ctx, x1.ID)
136136
if assert.NoError(t, err) {
137137
assert.Equal(t, x1, x2)
138138
}
@@ -141,11 +141,11 @@ func TestEveLocation(t *testing.T) {
141141
}
142142

143143
func TestLocationStructures(t *testing.T) {
144-
db, r, factory := testutil.NewDBInMemory()
144+
db, st, factory := testutil.NewDBInMemory()
145145
defer db.Close()
146146
httpmock.Activate()
147147
defer httpmock.DeactivateAndReset()
148-
s := eveuniverseservice.NewTestService(r)
148+
s := eveuniverseservice.NewTestService(st)
149149
t.Run("should return existing structure", func(t *testing.T) {
150150
// given
151151
testutil.TruncateTables(db)
@@ -189,7 +189,7 @@ func TestLocationStructures(t *testing.T) {
189189
assert.Equal(t, owner, x1.Owner)
190190
assert.Equal(t, system, x1.SolarSystem)
191191
assert.Equal(t, myType, x1.Type)
192-
x2, err := r.GetLocation(ctx, structureID)
192+
x2, err := st.GetLocation(ctx, structureID)
193193
if assert.NoError(t, err) {
194194
assert.Equal(t, x1, x2)
195195
}
@@ -225,7 +225,7 @@ func TestLocationStructures(t *testing.T) {
225225
assert.Nil(t, x1.Owner)
226226
assert.Nil(t, x1.SolarSystem)
227227
assert.Nil(t, x1.Type)
228-
x2, err := r.GetLocation(ctx, structureID)
228+
x2, err := st.GetLocation(ctx, structureID)
229229
if assert.NoError(t, err) {
230230
assert.Equal(t, x1, x2)
231231
}

0 commit comments

Comments
 (0)