Documentation ¶
Index ¶
- Variables
- type Activity
- type ActivityService
- type HandleActivity
- type Holiday
- type HolidayService
- type HolidayType
- type InputActivity
- type InputHoliday
- type InputToken
- type InputUser
- type InputWorkDay
- type MainOvertimeService
- type OvertimeService
- type Overview
- type Token
- type User
- type UserService
- type Webhook
- type WebhookBody
- type WebhookEvent
- type WebhookHandler
- type WebhookInput
- type WebhookService
- type WorkDay
- type WorkDayService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserNotFound = errors.New("User not found") ErrInvalidCredentials = errors.New("Login or password are wrong") ErrBadRequest = errors.New("Bad request") ErrPermissionDenied = errors.New("Permission denied") ErrActivityIsRunning = errors.New("A activity is currently running") ErrNoActivityIsRunning = errors.New("No activity is currently running") ErrDuplicateValue = errors.New("Duplicate value") ErrEmptyDescriptionNotAllowed = errors.New("empty description is not allowed") ErrStartMustBeBeforeEnd = errors.New("start time must be before end time") ErrReadOnlyAccess = errors.New("Readonly access") )
View Source
var ErrInvalidType = errors.New("invalid type")
Functions ¶
This section is empty.
Types ¶
type Activity ¶
type Activity struct { ID uint `gorm:"primaryKey"` InputActivity ActualDurationInMinutes uint EventualDurationInMinutes uint UserID uint } // @Name Activity
type ActivityService ¶
type ActivityService interface { StartActivity(desc string) (*Activity, error) AddActivity(activity Activity) (*Activity, error) UpdateActivity(activity Activity) (*Activity, error) StopRunningActivity() (*Activity, error) GetActivity(id uint) (*Activity, error) GetActivities(start time.Time, end time.Time) ([]Activity, error) DelActivity(id uint) error }
type HandleActivity ¶
type Holiday ¶
type Holiday struct { ID uint `gorm:"primaryKey"` InputHoliday UserID uint } // @Name Holiday
type HolidayService ¶
type HolidayService interface { AddHoliday(h Holiday) (*Holiday, error) UpdateHoliday(h Holiday) (*Holiday, error) GetHoliday(id uint) (*Holiday, error) GetHolidays(start time.Time, end time.Time) ([]Holiday, error) GetHolidaysByType(start time.Time, end time.Time, hType HolidayType) ([]Holiday, error) DelHoliday(id uint) error }
type HolidayType ¶
type HolidayType string
const ( HolidayTypeFree HolidayType = "free" HolidayTypeSick HolidayType = "sick" HolidayTypeLegalHoliday HolidayType = "legal_holiday" HolidayTypeLegalUnpaidFree HolidayType = "unpaid_free" )
func StrToHolidayType ¶
func StrToHolidayType(str string) (HolidayType, error)
type InputActivity ¶
type InputHoliday ¶
type InputToken ¶
type InputUser ¶
type InputWorkDay ¶
type MainOvertimeService ¶
type OvertimeService ¶
type OvertimeService interface { CalcOverview(day time.Time) (*Overview, error) ActivityService HolidayService WorkDayService UserService WebhookService }
func InitOvertimeClient ¶
func InitOvertimeClient(host string, authHeader string) OvertimeService
type Overview ¶
type Overview struct { Date time.Time `format:"date-time"` WeekNumber int UsedHolidays int HolidaysStillAvailable int OvertimeThisDayInMinutes int64 ActiveTimeThisDayInMinutes int64 OvertimeThisWeekInMinutes int64 ActiveTimeThisWeekInMinutes int64 OvertimeThisMonthInMinutes int64 ActiveTimeThisMonthInMinutes int64 OvertimeThisYearInMinutes int64 ActiveTimeThisYearInMinutes int64 ActiveActivity *Activity `extensions:"x-nullable"` } // @Name Overtime
type Token ¶
type Token struct { ID uint `gorm:"primaryKey"` InputToken UserID uint Token string } // @Name Token
type User ¶
type User struct { ID uint `gorm:"primaryKey"` Tokens []Token Password string `json:"-"` Name string Surname string Login string `gorm:"unique"` WorkingDays string WeekWorkingTimeInMinutes uint NumWorkingDays uint NumHolidays uint } // @Name User
func (*User) WorkingDaysAsArray ¶
type UserService ¶
type UserService interface { SaveUser(user User, adminToken string) (*User, error) DeleteUser(login string, adminToken string) error UpdateAccount(fields map[string]interface{}, user User) (*User, error) GetAccount() (*User, error) CreateToken(token InputToken) (*Token, error) DeleteToken(tokenID uint) error GetTokens() ([]Token, error) }
type Webhook ¶
type Webhook struct { ID uint `gorm:"primaryKey"` WebhookInput UserID uint } // @Name Webhook
type WebhookBody ¶
type WebhookBody struct { Event WebhookEvent Payload interface{} }
type WebhookEvent ¶
type WebhookEvent string
const ( StartActivityEvent WebhookEvent = "start_activity" EndActivityEvent WebhookEvent = "end_activity" )
type WebhookHandler ¶
type WebhookHandler interface { // HandleStartActivity will be called on start events HandleStartActivity(handler HandleActivity) // HandleEndActivity will be called on end events HandleEndActivity(Handler HandleActivity) // ListenAndServe listens on the TCP network address addr and then calls Serve with handler // to handle requests on incoming connections. ListenAndServe(host string) error }
func NewWebhookHanlder ¶
func NewWebhookHanlder() WebhookHandler
NewWebhookHandler returns simple http server, on which callbacks for events can be registered and they be automaticly called on their event type.
type WebhookInput ¶
type WebhookService ¶
type WebhookService interface { CreateWebhook(webhook WebhookInput) (*Webhook, error) GetWebhooks() ([]Webhook, error) }
type WorkDay ¶
type WorkDay struct { ID uint `gorm:"primaryKey"` InputWorkDay IsHoliday bool } // @Name WorkDay
Click to show internal directories.
Click to hide internal directories.