| 391 | } |
| 392 | |
| 393 | func (c *Client) BeforeSave(_ *pop.Connection) error { |
| 394 | if c.JSONWebKeys == nil { |
| 395 | c.JSONWebKeys = new(x.JoseJSONWebKeySet) |
| 396 | } |
| 397 | |
| 398 | if c.Metadata == nil { |
| 399 | c.Metadata = []byte("{}") |
| 400 | } |
| 401 | |
| 402 | if c.Audience == nil { |
| 403 | c.Audience = sqlxx.StringSliceJSONFormat{} |
| 404 | } |
| 405 | |
| 406 | if c.AllowedCORSOrigins == nil { |
| 407 | c.AllowedCORSOrigins = sqlxx.StringSliceJSONFormat{} |
| 408 | } |
| 409 | |
| 410 | if c.CreatedAt.IsZero() { |
| 411 | c.CreatedAt = time.Now() |
| 412 | } |
| 413 | c.CreatedAt = c.CreatedAt.UTC() |
| 414 | |
| 415 | if c.UpdatedAt.IsZero() { |
| 416 | c.UpdatedAt = time.Now() |
| 417 | } |
| 418 | c.UpdatedAt = c.UpdatedAt.UTC() |
| 419 | |
| 420 | return nil |
| 421 | } |
| 422 | |
| 423 | func (c *Client) GetID() string { |
| 424 | return c.ID |