-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add and endpoint which can be used for listing events
- Loading branch information
Showing
20 changed files
with
685 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ nos-notification-service-*.json | |
database.sqlite | ||
database.sqlite-journal | ||
run.sh | ||
_testdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package di | ||
|
||
import ( | ||
"github.com/google/wire" | ||
"github.com/planetary-social/nos-event-service/internal/logging" | ||
"github.com/planetary-social/nos-event-service/service/config" | ||
) | ||
|
||
var extractConfigSet = wire.NewSet( | ||
logLevelFromConfig, | ||
) | ||
|
||
func logLevelFromConfig(conf config.Config) logging.Level { | ||
return conf.LogLevel() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package mocks | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/planetary-social/nos-event-service/service/domain" | ||
) | ||
|
||
type ContactRepository struct { | ||
} | ||
|
||
func NewContactRepository() *ContactRepository { | ||
return &ContactRepository{} | ||
} | ||
|
||
func (c ContactRepository) GetCurrentContactsEvent(ctx context.Context, author domain.PublicKey) (domain.Event, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (c ContactRepository) SetContacts(ctx context.Context, event domain.Event, contacts []domain.PublicKey) error { | ||
panic("implement me") | ||
} | ||
|
||
func (c ContactRepository) GetFollowees(ctx context.Context, publicKey domain.PublicKey) ([]domain.PublicKey, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (c ContactRepository) IsFolloweeOfMonitoredPublicKey(ctx context.Context, publicKey domain.PublicKey) (bool, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (c ContactRepository) CountFollowers(ctx context.Context, publicKey domain.PublicKey) (int, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (c ContactRepository) CountFollowees(ctx context.Context, publicKey domain.PublicKey) (int, error) { | ||
panic("implement me") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package mocks | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/planetary-social/nos-event-service/service/domain" | ||
) | ||
|
||
type EventRepository struct { | ||
ListCalls []EventRepositoryListCall | ||
ListReturnValue []domain.Event | ||
} | ||
|
||
func NewEventRepository() *EventRepository { | ||
return &EventRepository{} | ||
} | ||
|
||
func (e EventRepository) Save(ctx context.Context, event domain.Event) error { | ||
panic("implement me") | ||
} | ||
|
||
func (e EventRepository) Get(ctx context.Context, eventID domain.EventId) (domain.Event, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (e EventRepository) Exists(ctx context.Context, eventID domain.EventId) (bool, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (e EventRepository) Count(ctx context.Context) (int, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (e *EventRepository) List(ctx context.Context, after *domain.EventId, limit int) ([]domain.Event, error) { | ||
e.ListCalls = append(e.ListCalls, EventRepositoryListCall{ | ||
After: after, | ||
Limit: limit, | ||
}) | ||
return e.ListReturnValue, nil | ||
} | ||
|
||
type EventRepositoryListCall struct { | ||
After *domain.EventId | ||
Limit int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package mocks | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/planetary-social/nos-event-service/service/app" | ||
"github.com/planetary-social/nos-event-service/service/domain" | ||
) | ||
|
||
type Metrics struct { | ||
} | ||
|
||
func NewMetrics() *Metrics { | ||
return &Metrics{} | ||
} | ||
|
||
func (m Metrics) StartApplicationCall(handlerName string) app.ApplicationCall { | ||
return NewApplicationCall() | ||
} | ||
|
||
func (m Metrics) ReportNumberOfRelayDownloaders(n int) { | ||
} | ||
|
||
func (m Metrics) ReportReceivedEvent(address domain.RelayAddress) { | ||
} | ||
|
||
func (m Metrics) ReportQueueLength(topic string, n int) { | ||
} | ||
|
||
func (m Metrics) ReportQueueOldestMessageAge(topic string, age time.Duration) { | ||
} | ||
|
||
func (m Metrics) ReportNumberOfStoredRelayAddresses(n int) { | ||
} | ||
|
||
func (m Metrics) ReportNumberOfStoredEvents(n int) { | ||
} | ||
|
||
func (m Metrics) ReportEventSentToRelay(address domain.RelayAddress, decision app.SendEventToRelayDecision, result app.SendEventToRelayResult) { | ||
} | ||
|
||
type ApplicationCall struct { | ||
} | ||
|
||
func NewApplicationCall() *ApplicationCall { | ||
return &ApplicationCall{} | ||
} | ||
|
||
func (a ApplicationCall) End(err *error) { | ||
} |
26 changes: 26 additions & 0 deletions
26
service/adapters/mocks/public_keys_to_monitor_repository.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package mocks | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/planetary-social/nos-event-service/service/domain" | ||
) | ||
|
||
type PublicKeysToMonitorRepository struct { | ||
} | ||
|
||
func NewPublicKeysToMonitorRepository() *PublicKeysToMonitorRepository { | ||
return &PublicKeysToMonitorRepository{} | ||
} | ||
|
||
func (p PublicKeysToMonitorRepository) Save(ctx context.Context, publicKeyToMonitor domain.PublicKeyToMonitor) error { | ||
panic("implement me") | ||
} | ||
|
||
func (p PublicKeysToMonitorRepository) List(ctx context.Context) ([]domain.PublicKeyToMonitor, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (p PublicKeysToMonitorRepository) Get(ctx context.Context, publicKey domain.PublicKey) (domain.PublicKeyToMonitor, error) { | ||
panic("implement me") | ||
} |
Oops, something went wrong.