Skip to content

Commit

Permalink
ทำ Entity ของระบบบันทึกข้อมูลโรคติดต่อ - close #3
Browse files Browse the repository at this point in the history
  • Loading branch information
KOB4k committed Dec 27, 2020
1 parent d46b15b commit 68c6a81
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions backend/ent/schema/Disease.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package schema

import (
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/edge"
"github.com/facebookincubator/ent/schema/field"
)

// Disease schema
type Disease struct {
ent.Schema
}

//Fields of the Disease
func (Disease) Fields() []ent.Field {
return []ent.Field{
field.String("Name"),
field.String("Symptom"),
field.String("Contagion"),
}
}

// Edges of the Disease.
func (Disease) Edges() []ent.Edge {
return []ent.Edge{

edge.From("employee", Employee.Type).Ref("disease").Unique(),
edge.From("severity", Severity.Type).Ref("disease").Unique(),
edge.From("diseasetype", Diseasetype.Type).Ref("disease").Unique(),
}
}

0 comments on commit 68c6a81

Please sign in to comment.