pcmt/ent/schema/hibp.go
leo 3a2f85f683
All checks were successful
continuous-integration/drone/push Build is passing
feat: add license headers (+spdx id)
2023-05-20 20:15:57 +02:00

58 lines
1.2 KiB
Go

// Copyright 2023 wanderer <a_mirre at utb dot cz>
// SPDX-License-Identifier: AGPL-3.0-only
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/field"
"github.com/google/uuid"
)
// HIBP holds the schema definition for the HIBP entity.
type HIBP struct {
ent.Schema
}
// Fields of the HIBP that model the HIBP API v3, ref:
// https://haveibeenpwned.com/API/v3.
func (HIBP) Fields() []ent.Field {
return []ent.Field{
field.UUID("id", uuid.UUID{}).
Unique().
Immutable(),
// Unique but may change.
field.String("name").
Unique(),
field.String("domain").
Immutable(),
field.Time("breach_date"),
// precision to the minute.
field.Time("added_date"),
field.Time("modified_date"),
field.Int("pwn_count"),
field.String("description").
Comment("May contain HTML markup"),
field.Strings("dataclasses"),
field.Bool("is_verified").
Default(false),
field.Bool("is_fabricated").
Default(false),
field.Bool("is_sensitive").
Default(false),
field.Bool("is_retired").
Default(false),
field.Bool("is_spamList").
Default(false),
field.Bool("is_malware").
Default(false),
field.String("logo").
Comment("Always in PNG format"),
}
}
// Edges of the HIBP.
func (HIBP) Edges() []ent.Edge {
return nil
}