models

package
v0.0.0-...-349e90a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type AuthData

type AuthData struct {
	Token string `json:"token"`
	User  *User  `json:"user"`
}

type Credentials

type Credentials struct {
	Email    string `json:"email"    validate:"required,email"`
	Password string `json:"password" validate:"required"`
}

type Group

type Group struct {
	ID          primitive.ObjectID `json:"id"                    bson:"_id"`
	Name        string             `json:"name"                  bson:"name"`
	Description *string            `json:"description,omitempty" bson:"description,omitempty"`
	UserID      primitive.ObjectID `json:"user_id"               bson:"user_id"`
}

type GroupData

type GroupData struct {
	ID          string  `json:"id"`
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

type GroupUpdate

type GroupUpdate struct {
	ID          primitive.ObjectID `json:"id"                    bson:"_id"`
	Name        *string            `json:"name,omitempty"        bson:"name,omitempty"`
	Description *string            `json:"description,omitempty" bson:"description,omitempty"`
}

type Habit

type Habit struct {
	ID          primitive.ObjectID `json:"id"                    bson:"_id"`
	Name        string             `json:"name"                  bson:"name"`
	Description *string            `json:"description,omitempty" bson:"description,omitempty"`
	Schedule    Schedule           `json:"schedule"              bson:"schedule"`
	GroupID     primitive.ObjectID `json:"group_id"              bson:"group_id"`
	UserID      primitive.ObjectID `json:"user_id"               bson:"user_id"`
}

func (*Habit) IsScheduled

func (h *Habit) IsScheduled(date time.Time) bool

type HabitCreate

type HabitCreate struct {
	Name        string             `json:"name"                  bson:"name"`
	Description *string            `json:"description,omitempty" bson:"description,omitempty"`
	Schedule    ScheduleInput      `json:"schedule"              bson:"schedule"`
	GroupID     primitive.ObjectID `json:"group_id"              bson:"group_id"`
	UserID      primitive.ObjectID `json:"user_id"               bson:"user_id"`
}

type HabitData

type HabitData struct {
	ID          string         `json:"id"`
	Name        *string        `json:"name,omitempty"`
	Description *string        `json:"description,omitempty"`
	Schedule    *ScheduleInput `json:"schedule,omitempty"`
	GroupID     *string        `json:"group_id,omitempty"`
}

type HabitFilterOptions

type HabitFilterOptions struct {
	UserID    primitive.ObjectID
	GroupID   *primitive.ObjectID
	StartDate *time.Time
	EndDate   *time.Time
	Succeeded *bool
}

type HabitUpdate

type HabitUpdate struct {
	ID          primitive.ObjectID  `json:"id"                    bson:"_id"`
	Name        *string             `json:"name,omitempty"        bson:"name,omitempty"`
	Description *string             `json:"description,omitempty" bson:"description,omitempty"`
	Schedule    *ScheduleInput      `json:"schedule,omitempty"    bson:"schedule,omitempty"`
	GroupID     *primitive.ObjectID `json:"group_id,omitempty"    bson:"group_id,omitempty"`
}

type NewGroup

type NewGroup struct {
	Name        string             `json:"name"                  bson:"name"`
	Description *string            `json:"description,omitempty" bson:"description,omitempty"`
	UserID      primitive.ObjectID `json:"user_id"               bson:"user_id"`
}

type NewHabit

type NewHabit struct {
	Name        string        `json:"name"                  bson:"name"`
	Description *string       `json:"description,omitempty" bson:"description,omitempty"`
	Schedule    ScheduleInput `json:"schedule"              bson:"schedule"`
	GroupID     string        `json:"group_id"              bson:"group_id"`
}

type NewSuccess

type NewSuccess struct {
	Date    time.Time `json:"date"     bson:"date"`
	HabitID string    `json:"habit_id" bson:"habit_id"`
}

type RepeatUnit

type RepeatUnit string

type Schedule

type Schedule struct {
	Type         ScheduleType `json:"type"                     bson:"type"`
	Weekdays     []Weekday    `json:"weekdays,omitempty"       bson:"weekdays,omitempty"`
	Monthdays    []int        `json:"monthdays,omitempty"      bson:"monthdays,omitempty"`
	PeriodInDays *int         `json:"period_in_days,omitempty" bson:"period_in_days,omitempty"`
	Start        time.Time    `json:"start"                    bson:"start"`
}

type ScheduleInput

type ScheduleInput struct {
	Type         ScheduleType `json:"type"                     bson:"type"`
	Weekdays     []Weekday    `json:"weekdays,omitempty"       bson:"weekdays,omitempty"`
	Monthdays    []int        `json:"monthdays,omitempty"      bson:"monthdays,omitempty"`
	PeriodInDays *int         `json:"period_in_days,omitempty" bson:"period_in_days,omitempty"`
	Start        time.Time    `json:"start"                    bson:"start"`
}

gqlgen does not allow using objects as inputs; only scalars, enums, and input_objects work

func (ScheduleInput) IsValid

func (e ScheduleInput) IsValid() bool

type ScheduleType

type ScheduleType string
const (
	ScheduleTypeWeekly   ScheduleType = "WEEKLY"
	ScheduleTypeMonthly  ScheduleType = "MONTHLY"
	ScheduleTypePeriodic ScheduleType = "PERIODIC"
)

func (ScheduleType) IsValid

func (e ScheduleType) IsValid() bool

func (ScheduleType) MarshalGQL

func (e ScheduleType) MarshalGQL(w io.Writer)

func (ScheduleType) String

func (e ScheduleType) String() string

func (*ScheduleType) UnmarshalGQL

func (e *ScheduleType) UnmarshalGQL(v interface{}) error

type Success

type Success struct {
	ID      primitive.ObjectID `json:"id"       bson:"_id"`
	Date    time.Time          `json:"date"     bson:"date"`
	HabitID primitive.ObjectID `json:"habit_id" bson:"habit_id"`
}

type SuccessCreate

type SuccessCreate struct {
	Date    time.Time          `json:"date"     bson:"date"`
	HabitID primitive.ObjectID `json:"habit_id" bson:"habit_id"`
}

type User

type User struct {
	ID       primitive.ObjectID `json:"id"       bson:"_id,omitempty"`
	Name     string             `json:"name"     bson:"name,omitempty"`
	Email    string             `json:"email"    bson:"email,omitempty"`
	Password string             `json:"password" bson:"password,omitempty"`
}

func (*User) ComparePassword

func (u *User) ComparePassword(password string) error

type Weekday

type Weekday string
const (
	WeekdayMonday    Weekday = "MONDAY"
	WeekdayTuesday   Weekday = "TUESDAY"
	WeekdayWednesday Weekday = "WEDNESDAY"
	WeekdayThursday  Weekday = "THURSDAY"
	WeekdayFriday    Weekday = "FRIDAY"
	WeekdaySaturday  Weekday = "SATURDAY"
	WeekdaySunday    Weekday = "SUNDAY"
)

func TimeToWeekday

func TimeToWeekday(date time.Time) Weekday

func (Weekday) IsValid

func (e Weekday) IsValid() bool

func (Weekday) MarshalGQL

func (e Weekday) MarshalGQL(w io.Writer)

func (Weekday) String

func (e Weekday) String() string

func (*Weekday) UnmarshalGQL

func (e *Weekday) UnmarshalGQL(v interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL