forked from NdoleStudio/httpsms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphone_repository.go
More file actions
33 lines (23 loc) · 1.11 KB
/
Copy pathphone_repository.go
File metadata and controls
33 lines (23 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package repositories
import (
"context"
"github.com/google/uuid"
"github.com/NdoleStudio/httpsms/pkg/entities"
)
// PhoneRepository loads and persists an entities.Phone
type PhoneRepository interface {
// Save Upsert a new entities.Phone
Save(ctx context.Context, phone *entities.Phone) error
// Index entities.Phone of a user
Index(ctx context.Context, userID entities.UserID, params IndexParams) (*[]entities.Phone, error)
// Load a phone by user and phone number
Load(ctx context.Context, userID entities.UserID, phoneNumber string) (*entities.Phone, error)
// LoadByID a phone by ID
LoadByID(ctx context.Context, userID entities.UserID, phoneID uuid.UUID) (*entities.Phone, error)
// Delete an entities.Phone
Delete(ctx context.Context, userID entities.UserID, phoneID uuid.UUID) error
// NullifyScheduleID sets MessageSendScheduleID to NULL for all phones referencing the given schedule
NullifyScheduleID(ctx context.Context, userID entities.UserID, scheduleID uuid.UUID) error
// DeleteAllForUser deletes all entities.Phone for a user
DeleteAllForUser(ctx context.Context, userID entities.UserID) error
}