Projeto bot pontos
This commit is contained in:
26
backend/internal/domain/point.go
Normal file
26
backend/internal/domain/point.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
var ErrInvalidPointHistory = errors.New("histórico de pontos inválido")
|
||||
|
||||
type Point struct {
|
||||
OccurredAt time.Time
|
||||
}
|
||||
|
||||
// Workday são os pontos de um dia, em ordem.
|
||||
type Workday struct {
|
||||
Points []Point
|
||||
Invalid bool // pontos repetidos ou fora de ordem
|
||||
Overtime bool // mais de quatro pontos (hora extra, fora do escopo)
|
||||
}
|
||||
|
||||
func (w Workday) Count() int { return len(w.Points) }
|
||||
|
||||
func (w Workday) Entry1() time.Time { return w.Points[0].OccurredAt }
|
||||
func (w Workday) Exit1() time.Time { return w.Points[1].OccurredAt }
|
||||
func (w Workday) Entry2() time.Time { return w.Points[2].OccurredAt }
|
||||
func (w Workday) Exit2() time.Time { return w.Points[3].OccurredAt }
|
||||
Reference in New Issue
Block a user