Open
Description
I have a model with a HasOne relationship like this...
Model("Avatar", func() {
Description("Avatar that will display by their name and profile")
Field("id", gorma.Integer, func() {
PrimaryKey()
})
Field("url", gorma.String)
})
Model("User", func() {
Description("User model")
HasOne("Avatar")
HasMany("Files")
and it fails to generate a helper function One[Model](ctx context.Context, id int)
method
func (m *UserDB) OneProjectUser(ctx context.Context, id int) (*app.ProjectUser, error) {
defer goa.MeasureSince([]string{"goa", "db", "projectUser", "oneprojectUser"}, time.Now())
var native User
err := m.Db.Scopes().Table(m.TableName()).Preload("Documents").Where("id = ?", id).Find(&native).Error
if err != nil && err != gorm.ErrRecordNotFound {
goa.LogError(ctx, "error getting User", "error", err.Error())
return nil, err
}
view := *native.UserToProjectUser()
return &view, err
}
Metadata
Assignees
Labels
No labels
Activity