lockserver/db/user_codes.go
Finn 350fc3b339
All checks were successful
/ build-container (push) Successful in 1m3s
rip out all auth stuff, add a containerfile
2024-04-23 17:34:57 -07:00

27 lines
420 B
Go

package db
import (
"time"
"git.janky.solutions/finn/lockserver/openapi"
)
func (u GetAllUserCodesRow) OpenAPI() openapi.UserCode {
resp := openapi.UserCode{Code: &u.Code}
if u.Name.Valid {
resp.User = &u.Name.String
}
if u.Start.Valid {
start := u.Start.Time.Format(time.RFC3339)
resp.Starts = &start
}
if u.End.Valid {
end := u.End.Time.Format(time.RFC3339)
resp.Ends = &end
}
return resp
}