crowdsec/pkg/database/ent/schema/bouncer.go
Thibault "bui" Koechlin cc1ab8c50d
switch to utc time everywhere (#1167)
* switch to utc time everywhere


Co-authored-by: alteredCoder <kevin@crowdsec.net>
2022-01-19 14:56:05 +01:00

39 lines
941 B
Go

package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/field"
"github.com/crowdsecurity/crowdsec/pkg/types"
)
// Bouncer holds the schema definition for the Bouncer entity.
type Bouncer struct {
ent.Schema
}
// Fields of the Bouncer.
func (Bouncer) Fields() []ent.Field {
return []ent.Field{
field.Time("created_at").
Default(types.UtcNow).
UpdateDefault(types.UtcNow).Nillable().Optional(),
field.Time("updated_at").
Default(types.UtcNow).
UpdateDefault(types.UtcNow).Nillable().Optional(),
field.String("name").Unique(),
field.String("api_key"), // hash of api_key
field.Bool("revoked"),
field.String("ip_address").Default("").Optional(),
field.String("type").Optional(),
field.String("version").Optional(),
field.Time("until").Default(types.UtcNow).Optional(),
field.Time("last_pull").
Default(types.UtcNow),
}
}
// Edges of the Bouncer.
func (Bouncer) Edges() []ent.Edge {
return nil
}