entity

package
v0.0.0-...-29f350e Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// JoinedOrder ...
	JoinedOrder RoomMemberOrderBy = "JOINED_ORDER"
	// DiaryOrder ...
	DiaryOrder = "DIARY_ORDER"
	// Ignore does not populate room member
	Ignore = "IGNORE"
)

Variables

This section is empty.

Functions

func PeriodToDuration

func PeriodToDuration(period uint8) time.Duration

PeriodToDuration returns period to time.Duration

Types

type Alarm

type Alarm struct {
	MemberID uint
	RoomID   uint
	Code     string
	Title    string
	RoomName string
	Author   string
	AlarmAt  *time.Time
}

Alarm represents alarm body

func NewAlarm

func NewAlarm(memberID, roomID uint, code vo.TaskCode, roomName, diaryTitle, authorNickname string) *Alarm

NewAlarm ...

func (*Alarm) ToMap

func (a *Alarm) ToMap() (alarmMap map[string]string)

ToMap converts Alarm to map type

func (*Alarm) UnqFields

func (a *Alarm) UnqFields() (roomID, memberID uint, code vo.TaskCode)

UnqFields returns alarm's unique field component.

type Alarms

type Alarms []Alarm

Alarms ...

type AuthCodeClaims

type AuthCodeClaims struct {
	AuthType string `json:"auth_type"`
	ID       uint   `json:"id"`
	Email    string `json:"email"`
	Name     string `json:"name"`
	jwt.StandardClaims
}

AuthCodeClaims ...

type Member

type Member struct {
	ID         uint
	Email      string
	Name       string
	ProfileURL string
	AuthType   string
	AlarmFlag  bool
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

Member ...

func NewMember

func NewMember(email, name, profileURL string, authType string) (*Member, error)

NewMember ...

func (*Member) IsEqual

func (a *Member) IsEqual(other *Member) bool

IsEqual guarantees Entity's identity

func (*Member) IsNil

func (a *Member) IsNil() bool

IsNil check member is nil

type MemberDevice

type MemberDevice struct {
	ID          uint
	MemberID    uint
	DeviceToken string

	CreatedAt time.Time
	UpdatedAt time.Time
}

MemberDevice maps member and firebase device token ID

func NewMemberDevice

func NewMemberDevice(memberID uint, token string) (*MemberDevice, error)

NewMemberDevice ...

func (*MemberDevice) IsEqual

func (md *MemberDevice) IsEqual(other *MemberDevice) bool

IsEqual guarantees Entity's identity

type MemberDevices

type MemberDevices []MemberDevice

MemberDevices ...

type Members

type Members []Member

Members ...

type Room

type Room struct {
	ID     uint
	Name   string
	Code   string
	Hint   string
	Theme  string
	Period uint8

	MasterID      uint
	TurnAccountID uint
	Orders        []uint // master + roomMembers
	Members       *Members

	DueAt     *time.Time
	CreatedAt *time.Time
	UpdatedAt *time.Time
}

Room ...

func NewRoom

func NewRoom(masterID uint, name, code, hint, theme string, period uint8) (*Room, error)

NewRoom ...

func (*Room) AppendMember

func (r *Room) AppendMember(accountID uint)

AppendMember ...

func (*Room) BeforeDueAt

func (r *Room) BeforeDueAt() *time.Time

BeforeDueAt returns (current_room_due_at - oldPeriod) It is used for change period

func (*Room) ChangeMaster

func (r *Room) ChangeMaster() error

ChangeMaster ...

func (*Room) IsAlreadyJoined

func (r *Room) IsAlreadyJoined(accountID uint) bool

IsAlreadyJoined determines whether account is master or member of room

func (*Room) IsEqual

func (r *Room) IsEqual(other *Room) bool

IsEqual guarantees Entity's identity

func (*Room) IsMaster

func (r *Room) IsMaster(accountID uint) bool

IsMaster returns whether account is a room's master or not

func (*Room) IsMemberFull

func (r *Room) IsMemberFull() bool

IsMemberFull ...

func (*Room) IsTurn

func (r *Room) IsTurn(accountID uint) bool

IsTurn returns whether account is a room's turn or not

func (*Room) MemberAllExceptTurnAccount

func (r *Room) MemberAllExceptTurnAccount() []uint

MemberAllExceptTurnAccount returns every members except current turn member.

func (*Room) MemberOnlyOrders

func (r *Room) MemberOnlyOrders() ([]uint, error)

MemberOnlyOrders returns master excluded memberIDs

func (*Room) NextDueAt

func (r *Room) NextDueAt() *time.Time

NextDueAt returns room.CreatedAt + period timestamp

func (*Room) NextTurn

func (r *Room) NextTurn() (nextTurnAccountID uint)

NextTurn set room.TurnAccountID to next-turnAccountID and return it.

func (*Room) OrdersToJSON

func (r *Room) OrdersToJSON() ([]byte, error)

OrdersToJSON 는 []uint 타입을 []byte json타입으로 마샬링한다.

func (*Room) RemoveMember

func (r *Room) RemoveMember(accountID uint) (uint, error)

RemoveMember ...

type RoomMember

type RoomMember struct {
	ID        uint
	RoomID    uint
	AccountID uint
	CreatedAt time.Time
}

RoomMember maps room and accout

func NewRoomMember

func NewRoomMember(roomID, accountID uint) (*RoomMember, error)

NewRoomMember ...

func (*RoomMember) IsEqual

func (r *RoomMember) IsEqual(other *RoomMember) bool

IsEqual guarantees Entity's identity

type RoomMemberOrderBy

type RoomMemberOrderBy string

RoomMemberOrderBy represents how to order Room's member populate ordering.

type RoomMembers

type RoomMembers []RoomMember

RoomMembers ...

type Rooms

type Rooms []Room

Rooms ...

type Token

type Token struct {
	AccessToken  string
	RefreshToken string
}

Token ...

Jump to

Keyboard shortcuts

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