model

package
v0.0.0-...-1c9237d Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BieterCSVHeader

func BieterCSVHeader() []string

BieterCSVHeader returns the header coresponding to Bieter.CSVRecord().

Types

type Bieter

type Bieter struct {
	ID            int           `json:"id"`
	Vorname       string        `json:"vorname"`
	Nachname      string        `json:"nachname"`
	Mail          string        `json:"mail"`
	Adresse       string        `json:"adresse"`
	Mitglied      bool          `json:"mitglied"`
	Verteilstelle Verteilstelle `json:"verteilstelle"`
	Teilpartner   string        `json:"teilpartner"`
	IBAN          string        `json:"iban"`
	Kontoinhaber  string        `json:"kontoinhaber"`
	Jaehrlich     bool          `json:"jaehrlich"`
	Gebot         Gebot         `json:"gebot"`
	Anwesend      bool          `json:"anwesend"`
	CanSelfEdit   bool          `json:"can_edit"`
}

Bieter is a person that makes an offer.

func (Bieter) CSVRecord

func (b Bieter) CSVRecord() []string

CSVRecord returns the bieter as csv record

func (Bieter) InvalidFields

func (b Bieter) InvalidFields() map[string]string

InvalidFields returns a map from invalid fields to an error message.

func (Bieter) Name

func (b Bieter) Name() string

Name returns the full name.

func (Bieter) ShowKontoinhaber

func (b Bieter) ShowKontoinhaber() string

ShowKontoinhaber the kontoinhaber

type Event

type Event = sticky.Event[Model]

Event is something that can happen in the bietrunde.

func GetEvent

func GetEvent(eventType string) Event

GetEvent returns an empty event.

type Gebot

type Gebot int

Gebot is an offer.

func GebotFromString

func GebotFromString(str string) (Gebot, error)

GebotFromString parses a string into an gebot.

func (Gebot) Empty

func (g Gebot) Empty() bool

Empty is true, if there is no offer.

func (Gebot) NumberString

func (g Gebot) NumberString() string

NumberString returns a number for the form field.

func (Gebot) String

func (g Gebot) String() string

type Model

type Model struct {
	Bieter map[int]Bieter
	State  ServiceState
}

Model of the service.

func New

func New() Model

New returns an initialized model.

func (Model) BieterCreate

func (m Model) BieterCreate() (int, Event)

BieterCreate creates a new bieter with empty data.

func (Model) BieterDelete

func (m Model) BieterDelete(id int) Event

BieterDelete deletes a bieter.

func (Model) BieterSetAnwesend

func (m Model) BieterSetAnwesend(id int, anwesend bool) Event

BieterSetAnwesend deletes a bieter.

func (Model) BieterSetCanSelfEdit

func (m Model) BieterSetCanSelfEdit(id int, canEdit bool) Event

BieterSetCanSelfEdit sets the attribute CanSelfEdit.

func (Model) BieterUpdate

func (m Model) BieterUpdate(bieter Bieter) Event

BieterUpdate updates all fields of a bieter.

func (Model) ResetGebot

func (m Model) ResetGebot() Event

ResetGebot sets all gebote to 0.

func (Model) SetGebot

func (m Model) SetGebot(bietID int, gebot Gebot) Event

SetGebot sets the gebot for an user.

func (Model) SetState

func (m Model) SetState(state ServiceState) Event

SetState sets the service state.

type ServiceState

type ServiceState int

ServiceState is the state of the service.

const (
	StateInvalid ServiceState = iota
	StateRegistration
	StateValidation
	StateOffer
	StateFinish
)

States of the service.

func StateFromAttr

func StateFromAttr(attr string) ServiceState

StateFromAttr converts a attribute string representation to ServiceState.

func States

func States() []ServiceState

States returns all possible states

func (ServiceState) String

func (s ServiceState) String() string

func (ServiceState) ToAttr

func (s ServiceState) ToAttr() string

ToAttr converts to a attribute for select elements

type Verteilstelle

type Verteilstelle int

Verteilstelle is an enum type

const (
	VerteilstelleNone Verteilstelle = iota
	VerteilstelleVillingen
	VerteilstelleSchwenningen
	VerteilstelleUeberauchen
)

Different enum values

func VerteilstelleFromAttr

func VerteilstelleFromAttr(attr string) Verteilstelle

VerteilstelleFromAttr converts a attribute string representation to Verteilstelle.

func (Verteilstelle) String

func (v Verteilstelle) String() string

func (Verteilstelle) ToAttr

func (v Verteilstelle) ToAttr() string

ToAttr converts the Verteilstelle to a simple string that can be used in select statements.

Jump to

Keyboard shortcuts

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