You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
609 B
40 lines
609 B
2 years ago
|
package customer
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
apiKafka "git.slaventius.ru/test3k/umate/pkg/kafka"
|
||
|
)
|
||
|
|
||
|
// Покупатель
|
||
|
type Customer struct {
|
||
|
SimpleRow
|
||
|
Login string
|
||
|
Password string
|
||
|
Confirmed bool
|
||
|
apiKafka.MessageRegistration
|
||
|
Time time.Time
|
||
|
}
|
||
|
|
||
|
func (c *Customer) Update() error {
|
||
|
_, err := c.collection.UpdateDocument(c.ctx, c.key, c)
|
||
|
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
func (c *Customer) Delete() error {
|
||
|
return c.SimpleRow.Delete()
|
||
|
}
|
||
|
|
||
|
func (c *Customer) Refresh() error {
|
||
|
c.Time = time.Now().Add(time.Minute * 15)
|
||
|
|
||
|
return c.Update()
|
||
|
}
|
||
|
|
||
|
func (c *Customer) Confirm() error {
|
||
|
c.Confirmed = true
|
||
|
|
||
|
return c.Update()
|
||
|
}
|