mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-03 10:22:18 +00:00
- 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
44 lines
1.3 KiB
Go
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
|
|
}
|