adding validated services? patching forcad_local.py
This commit is contained in:
34
OmCTF-2025/services/block_game/backend/schema/user.go
Normal file
34
OmCTF-2025/services/block_game/backend/schema/user.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// User holds the schema definition for the User entity.
|
||||
type User struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the User.
|
||||
func (User) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("username").
|
||||
Unique().
|
||||
Match(regexp.MustCompile(`^\w{1,64}$`)),
|
||||
field.String("password").
|
||||
MaxLen(128).
|
||||
NotEmpty(),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the User.
|
||||
func (User) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.To("ownedLevels", Level.Type),
|
||||
edge.To("invitedToLevels", Level.Type),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user