Documentation ¶
Index ¶
- Variables
- type Client
- type Family
- type Membership
- type Profile
- func (p *Profile) Create(ctx context.Context, db database.DB) (*Profile, error)
- func (p *Profile) Delete(ctx context.Context, db database.DB) error
- func (p *Profile) DeleteAllBoards(ctx context.Context, db database.DB) error
- func (p *Profile) DeleteSettings(ctx context.Context, db database.DB) error
- func (p *Profile) DeleteSubscription(ctx context.Context, db database.DB) error
- func (p *Profile) DeleteTherapistLinks(ctx context.Context, db database.DB) error
- func (p *Profile) GetClientList(ctx context.Context, db database.DB) ([]Client, error)
- func (p *Profile) GetDetails(ctx context.Context, db database.DB) (*Profile, error)
- func (p *Profile) GetFamily(ctx context.Context, db database.DB) (*Family, error)
- func (p *Profile) GetID(ctx context.Context, db database.DB) (*Profile, error)
- func (p *Profile) GetSettings(ctx context.Context, db database.DB) (*Settings, error)
- func (p *Profile) GetSubscription(ctx context.Context, db database.DB) (*Subscription, error)
- func (p *Profile) GetSubscriptionID(ctx context.Context, db database.DB) (*Profile, error)
- func (p *Profile) HasSubscription() bool
- func (p *Profile) LinkTherapist(ctx context.Context, db database.DB, therapist *Profile) (*Profile, error)
- func (p *Profile) New(ctx context.Context, db database.DB) (*Profile, error)
- func (p *Profile) NewSubscription(ctx context.Context, db database.DB, seats int, dashboardAccess bool) (*Subscription, error)
- func (p *Profile) RemoveSubscription(ctx context.Context, db database.DB) error
- func (p *Profile) Save(ctx context.Context, db database.DB, isNew bool) (*Profile, error)
- func (p *Profile) SaveSettings(ctx context.Context, db database.DB, settings Settings) error
- func (p *Profile) Tokenize(ctx context.Context, secret string, timestamp time.Time) (string, error)
- func (p *Profile) ValidateToken(ctx context.Context, secret string, tokenString string) (*Profile, error)
- type Settings
- type SpeechSettings
- type Subscription
- type ThemeSettings
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoSubscription is returned when a user does not have a subscription ErrNoSubscription = errors.New("no subscription") )
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.0.51
type Client struct { Active bool `db:"active" json:"active"` CreatedAt *time.Time `db:"created_at" json:"createdAt,omitempty"` TherapistID *uuid.UUID `db:"therapist_id" json:"therapistId,omitempty"` ID *uuid.UUID `db:"id" json:"id,omitempty"` ProfileID *uuid.UUID `db:"user_id" json:"profileId,omitempty"` UpdatedAt *time.Time `db:"updated_at" json:"updatedAt,omitempty"` // joined fields Profile *Profile `json:"profile,omitempty"` }
Client is a therapist's client
type Family ¶ added in v0.0.12
type Family struct { CreatedAt time.Time `db:"created_at" json:"createdAt,omitempty"` ID *uuid.UUID `db:"id" json:"id,omitempty"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt,omitempty"` Members []Membership `json:"members,omitempty"` }
type Membership ¶ added in v0.0.12
type Membership struct { AcceptedInvite bool `db:"accepted_invite" json:"acceptedInvite"` CreatedAt *time.Time `db:"created_at" json:"createdAt,omitempty"` FamilyID *uuid.UUID `db:"family_id" json:"familyId,omitempty"` ID *uuid.UUID `db:"id" json:"id,omitempty"` InviteCode *uuid.UUID `db:"invite_code" json:"inviteCode,omitempty"` IsAdmin bool `db:"is_admin" json:"isAdmin"` ProfileID *uuid.UUID `db:"f_profile_id" json:"profileId,omitempty"` UpdatedAt *time.Time `db:"updated_at" json:"updatedAt,omitempty"` // joined fields Profile *Profile `json:"profile,omitempty"` Therapist *Profile `json:"therapist,omitempty"` }
Membership is a user's relationship to a family
type Profile ¶
type Profile struct { CreatedAt time.Time `json:"createdAt,omitempty"` Email string `json:"email,omitempty"` ID *uuid.UUID `json:"id,omitempty"` Image string `json:"image,omitempty"` Name string `json:"name,omitempty"` SubscriptionID *uuid.UUID `json:"subscriptionId,omitempty"` IsTherapist bool `json:"isTherapist,omitempty"` UpdatedAt time.Time `json:"updatedAt,omitempty"` // joined details HomeBoardID *uuid.UUID `json:"homeBoardId,omitempty"` IsAdmin bool `json:"isAdmin,omitempty"` }
Profile defines the profile of a user
func (*Profile) DeleteAllBoards ¶ added in v0.0.36
DeleteAllBoards deletes the users boards
func (*Profile) DeleteSettings ¶ added in v0.0.36
DeleteSettings deletes the users application settings
func (*Profile) DeleteSubscription ¶ added in v0.0.50
DeleteSubscription delete a subscription
func (*Profile) DeleteTherapistLinks ¶ added in v0.0.37
deleteTherapistLinks deletes any therapist links for the profile
func (*Profile) GetClientList ¶ added in v0.0.51
GetClientList finds all the patients linked to a therapist
func (*Profile) GetDetails ¶ added in v0.0.4
GetDetails for a profile
func (*Profile) GetSettings ¶ added in v0.0.10
GetSettings finds the users application settings
func (*Profile) GetSubscription ¶ added in v0.0.18
GetSubscription finds the subscription for the family
func (*Profile) GetSubscriptionID ¶ added in v0.0.18
GetSubscriptionID for a profile
func (*Profile) HasSubscription ¶ added in v0.0.22
Has subscription returns true if there is a valid subscription id for the user
func (*Profile) LinkTherapist ¶ added in v0.0.27
func (p *Profile) LinkTherapist(ctx context.Context, db database.DB, therapist *Profile) (*Profile, error)
LinkTherapist links a therapist to a profile
func (*Profile) NewSubscription ¶ added in v0.0.46
func (p *Profile) NewSubscription(ctx context.Context, db database.DB, seats int, dashboardAccess bool) (*Subscription, error)
NewSubscription creates a new subscription for a profile
func (*Profile) RemoveSubscription ¶ added in v0.0.41
RemoveSubscription from a profile
func (*Profile) Save ¶ added in v0.0.2
Save a profile @TODO: save should be reworked in a way that can be used for both new and existing profiles with and without a family - maybe the issue is actually in registration and not here ie: save the profile then create the family/membership
func (*Profile) SaveSettings ¶ added in v0.0.53
SaveSettings saves the users application settings
type Settings ¶ added in v0.0.10
type Settings struct { Analytics bool `db:"analytics" json:"analytics"` Speech SpeechSettings `db:"speech" json:"speech"` Theme ThemeSettings `db:"theme" json:"theme"` }
type SpeechSettings ¶ added in v0.0.53
type Subscription ¶ added in v0.0.18
type Subscription struct { Active bool `json:"active"` CreatedAt time.Time `json:"createdAt,omitempty"` DashboardAccess bool `json:"dashboardAccess"` ExpiresOn time.Time `json:"expiresOn,omitempty"` FamilyID *uuid.UUID `json:"familyId,omitempty"` ID *uuid.UUID `json:"id,omitempty"` Paid bool `json:"paid"` TotalSeats int `json:"totalSeats"` UpdatedAt time.Time `json:"updated_at,omitempty"` UsedSeats int `json:"usedSeats"` Renew bool `json:"renew"` }