daddy/internal/model/workgroup.go
William Petit 676ddf3bc8 Base d'API backend pour la manipulation des groupes de travail
Types:

type Workgroup {
  id: ID!
  name: String
  createdAt: Time!
  closedAt: Time
  members: [User]!
}

Mutations:

joinWorkgroup(workgroupId: ID!): Workgroup!
leaveWorkgroup(workgroupId: ID!): Workgroup!
createWorkgroup(changes: WorkgroupChanges!): Workgroup!
closeWorkgroup(workgroupId: ID!): Workgroup!
updateWorkgroup(workgroupId: ID!, changes: WorkgroupChanges!): Workgroup!

Queries:

workgroups: [Workgroup]!
2020-07-23 08:28:23 +02:00

19 lines
291 B
Go

package model
import (
"time"
"github.com/jinzhu/gorm"
)
type Workgroup struct {
gorm.Model
Name *string `json:"name"`
ClosedAt time.Time `json:"closedAt"`
Members []*User `gorm:"many2many:users_workgroups;"`
}
type WorkgroupChanges struct {
Name *string `json:"name"`
}