-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.go
70 lines (66 loc) · 1.6 KB
/
user.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package schema
import (
"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("login").Unique(),
field.Int64("id"),
field.String("node_id"),
field.String("avatar_url"),
field.String("gravatar_id").
Optional(),
field.String("url"),
field.String("html_url"),
field.String("followers_url"),
field.String("following_url"),
field.String("gists_url"),
field.String("starred_url"),
field.String("subscriptions_url"),
field.String("organizations_url"),
field.String("repos_url"),
field.String("events_url"),
field.String("received_events_url"),
field.String("type"),
field.Bool("site_admin"),
field.String("name").
Optional(),
field.String("company").
Optional(),
field.String("blog").
Optional(),
field.String("location").
Optional(),
field.String("email").
Optional(),
field.Bool("hireable").
Optional(),
field.String("bio").
Optional(),
field.Int64("public_repos"),
field.Int64("public_gists"),
field.Int64("followers"),
field.Int64("following"),
field.Time("created_at"),
field.Time("updated_at"),
}
}
// Edges of the User.
func (User) Edges() []ent.Edge {
return []ent.Edge{
edge.To("repositories", Repository.Type),
edge.To("issues_created", Issue.Type),
edge.To("comments_created", IssueComment.Type),
edge.From("issues_assigned", Issue.Type).
Ref("assignees"),
edge.From("issues_closed", Issue.Type).
Ref("closed_by"),
}
}