Skip to content

Instantly share code, notes, and snippets.

@anatoliyfedorenko
Last active July 13, 2020 06:03
Show Gist options
  • Save anatoliyfedorenko/a69412565a36af2b72e7e13297001f76 to your computer and use it in GitHub Desktop.
Save anatoliyfedorenko/a69412565a36af2b72e7e13297001f76 to your computer and use it in GitHub Desktop.
Interface Refactoring
// IStorage represents database methods
type IStorage interface {
// User() User
// Profile() Profile
// Agreement() Agreement
// AgreementChanges() AgreementChange
// Milestone() Milestone
// Contact() Contact
// Notifications() Notification
// Payout() Payout
// WebhookEvents() WebhookEvent
// Referrals() Referral
// VerificationCodes() VerificationCode
// Feedback() Feedback
// PlatformTransfe() PlatformTransfer
// this is just a temporary change not to break all the functionality. Will reimplment this
// for the version mentioned above as a next step with just a small chucks under improvements
User
Profile
Agreement
AgreementChange
Milestone
Contact
Notification
Payout
WebhookEvent
Referral
VerificationCode
Feedback
PlatformTransfer
}
// Notification inferface contains methods for notifications manipulation
type Notification interface {
CreateNotification(ctx context.Context, n *model.Notification) (model.Notification, error)
GetNotification(ctx context.Context, id int64) (model.Notification, error)
GetUnreadNotificationsCount(ctx context.Context, receiverID int64) (int, error)
ListNotification(ctx context.Context, userID int64) ([]model.Notification, error)
SetNotificationAsRead(ctx context.Context, id int64) error
ResetUnreadNotifications(ctx context.Context, receiverID int64) error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment