Files
telecom-platform/apps/carrier-connector/internal/repository/profile.go
T
nutcas3 8e40a54d8b feat: Add liveness and readiness health check endpoints with database connectivity validation
- Add Ping method to PostgresProfileStore to check database connection status
- Add Ping method to ProfileRepository interface
- Add /api/v1/health/live endpoint for liveness checks (always returns alive if service is running)
- Add /api/v1/health/ready endpoint for readiness checks with database connectivity validation
- Add readinessHandler that returns SERVICE_UNAVAILABLE status when database ping fails
2026-04-25 03:23:01 +03:00

44 lines
1.3 KiB
Go

package repository
import (
"context"
"errors"
"time"
)
// ErrNotFound is returned when a profile lookup misses.
var ErrNotFound = errors.New("profile not found")
// Profile is the stored representation of an eSIM profile.
type Profile struct {
ICCID string `json:"iccid"`
EID string `json:"eid,omitempty"`
IMSI string `json:"imsi"`
MCC string `json:"mcc"`
MNC string `json:"mnc"`
ProfileType string `json:"profileType"`
State string `json:"state"`
TenantID string `json:"tenantId,omitempty"`
ActivationCode string `json:"activationCode,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
// ListFilter narrows the List query.
type ListFilter struct {
TenantID string
State string
Limit int
Offset int
}
// ProfileRepository is the storage contract for eSIM profiles.
type ProfileRepository interface {
Create(ctx context.Context, p *Profile) error
Get(ctx context.Context, iccid string) (*Profile, error)
List(ctx context.Context, f ListFilter) ([]*Profile, int, error)
UpdateState(ctx context.Context, iccid, state string) (*Profile, error)
Delete(ctx context.Context, iccid string) error
Ping() error
}