feat: set timezone space level
All checks were successful
Deploy / build-and-deploy (push) Successful in 2m25s
All checks were successful
Deploy / build-and-deploy (push) Successful in 2m25s
This commit is contained in:
parent
945069052f
commit
08f6b034f5
12 changed files with 196 additions and 23 deletions
|
|
@ -13,10 +13,24 @@ type Space struct {
|
|||
ID string `db:"id"`
|
||||
Name string `db:"name"`
|
||||
OwnerID string `db:"owner_id"`
|
||||
Timezone *string `db:"timezone"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
}
|
||||
|
||||
// Location returns the *time.Location for this space's timezone.
|
||||
// Returns nil if timezone is not set, so callers can distinguish "not set" from "UTC".
|
||||
func (s *Space) Location() *time.Location {
|
||||
if s.Timezone == nil || *s.Timezone == "" {
|
||||
return nil
|
||||
}
|
||||
loc, err := time.LoadLocation(*s.Timezone)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return loc
|
||||
}
|
||||
|
||||
type SpaceMember struct {
|
||||
SpaceID string `db:"space_id"`
|
||||
UserID string `db:"user_id"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue