entity

package
v0.0.0-...-93e8ec0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package entity defines main entities for business logic (services), data base mapping and HTTP response objects if suitable. Each logic group entities in own file.

Index

Constants

This section is empty.

Variables

View Source
var ReasonList = map[int]*AbsenceReason{
	1: {
		ID:          1,
		Description: "Личные дела",
		Emoji:       "🏠",
	},
	2: {
		ID:          2,
		Description: "Гостевой пропуск",
		Emoji:       "✈",
	},
	3: {
		ID:          3,
		Description: "Командировка",
		Emoji:       "✈",
	},
	4: {
		ID:          4,
		Description: "Местная командировка",
		Emoji:       "🚙",
	},
	5: {
		ID:          5,
		Description: "Болезнь",
		Emoji:       "🌡",
	},
	6: {
		ID:          6,
		Description: "Больничный лист",
		Emoji:       "🏥",
	},
	7: {
		ID:          7,
		Description: "Ночные работы",
		Emoji:       "🌃",
	},
	8: {
		ID:          8,
		Description: "Дежурство",
		Emoji:       "👨‍💻",
	},
	9: {
		ID:          9,
		Description: "Учеба",
		Emoji:       "📚",
	},
	10: {
		ID:          10,
		Description: "Удаленная работа",
		Emoji:       "🏠",
	},
	11: {
		ID:          11,
		Description: "Отпуск",
		Emoji:       "🌅",
	},
	12: {
		ID:          12,
		Description: "Отпуск за свой счет",
		Emoji:       "⛺",
	},
	13: {
		ID:          13,
		Description: "Отсутствие с отработкой",
		Emoji:       "⌛",
	},
}

ReasonList stores AbsenceReason in-memory.

Functions

This section is empty.

Types

type AbsenceReason

type AbsenceReason struct {
	Description string
	Emoji       string
	ID          int
}

AbsenceReason wraps info about user absence reason.

type Credentials

type Credentials struct {
	IP          string
	Port        string
	Login       string
	Password    string
	EmployeeURL string
	AbsenceURL  string
}

Credentials contains info for authentication and working with a third-party WebAPI.

func TestCredentials

func TestCredentials() *Credentials

TestCredentials returns the Credentials entity initialized with valid data.

func (*Credentials) Validate

func (c *Credentials) Validate() error

Validate validates fields of the Credentials entity.

type CustomDate

type CustomDate struct {
	time.Time
}

CustomDate contains date in a custom format.

func (CustomDate) MarshalJSON

func (t CustomDate) MarshalJSON() ([]byte, error)

MarshalJSON is a redefined method for correct json.Encoder work.

func (*CustomDate) UnmarshalJSON

func (t *CustomDate) UnmarshalJSON(data []byte) error

UnmarshalJSON is a redefined method for correct json.Decoder work.

type CustomTime

type CustomTime struct {
	time.Time
}

CustomDate contains time in a custom format.

func (CustomTime) MarshalJSON

func (t CustomTime) MarshalJSON() ([]byte, error)

MarshalJSON is a redefined method for correct json.Encoder work.

func (*CustomTime) UnmarshalJSON

func (t *CustomTime) UnmarshalJSON(data []byte) error

UnmarshalJSON is a redefined method for correct json.Decoder work.

type User

type User struct {
	DisplayName string `json:"displayName,omitempty"`
	Email       string `json:"email,omitempty"`
	MobilePhone string `json:"mobilePhone,omitempty"`
	WorkPhone   string `json:"workPhone,omitempty"`
	ID          int    `json:"id,omitempty"`
}

User contains info about user.

func TestUser

func TestUser() *User

TestUser returns the User entity initialized with valid data.

func (*User) Validate

func (u *User) Validate() error

Validate validates fields of the User entity.

type UserAbsenceData

type UserAbsenceData struct {
	CreatedDate CustomDate `json:"createdDate,omitempty"`
	DateFrom    CustomTime `json:"dateFrom,omitempty"`
	DateTo      CustomTime `json:"dateTo,omitempty"`
	ID          int        `json:"id,omitempty"`
	PersonID    int        `json:"personId,omitempty"`
	ReasonID    int        `json:"reasonId,omitempty"`
}

UserAbsenceData represents user absence status info from third-party WebAPI.

func TestUserAbsenceData

func TestUserAbsenceData() *UserAbsenceData

TestUserAbsenceData returns the UserAbsenceData entity initialized with valid data.

Jump to

Keyboard shortcuts

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