httpsms-gateway / api /pkg /repositories /contact_repository.go
ML Intern deploy
Deploy httpSMS gateway to Hugging Face Spaces (Docker SDK): nginx :7860 -> Go API :8000, Nuxt SPA, Android APK, bootstrap-mode entrypoint
83a59ca
Raw History Blame Contribute Delete
1.44 kB
package repositories
import (
"context"
"github.com/NdoleStudio/httpsms/pkg/entities"
"github.com/google/uuid"
)
// ContactRepository loads and persists an entities.Contact.
type ContactRepository interface {
// Store one or many new entities.Contact.
Store(ctx context.Context, contacts []*entities.Contact) error
// Update an existing entities.Contact.
Update(ctx context.Context, contact *entities.Contact) error
// Load a contact by ID for a user.
Load(ctx context.Context, userID entities.UserID, contactID uuid.UUID) (*entities.Contact, error)
// Index contacts for a user with optional search.
Index(ctx context.Context, userID entities.UserID, params IndexParams) (*[]entities.Contact, error)
// Count returns the number of contacts for a user matching the same
// name/emails/phone_numbers filter as Index, ignoring pagination.
Count(ctx context.Context, userID entities.UserID, params IndexParams) (int64, error)
// FetchByPhoneNumbers returns contacts containing at least one requested
// phone number, ordered by updated_at ascending.
FetchByPhoneNumbers(ctx context.Context, userID entities.UserID, phoneNumbers []string) (*[]entities.Contact, error)
// Delete a contact by ID for a user.
Delete(ctx context.Context, userID entities.UserID, contactID uuid.UUID) error
// DeleteAllForUser deletes all contacts for a user.
DeleteAllForUser(ctx context.Context, userID entities.UserID) error
}