Split Create User (#50502)
* Split Create User * Use new create user and User from package user * Add service to wire * Making create user work * Replace user from user pkg * One more * Move Insert to orguser Service/Store * Remove unnecessary conversion * Cleaunp * Fix Get User and add fakes * Fixing get org id for user logic, adding fakes and other adjustments * Add some tests for ourguser service and store * Fix insert org logic * Add comment about deprecation * Fix after merge with main * Move orguser service/store to org service/store * Remove orguser from wire * Unimplement new Create user and use User from pkg user * Fix wire generation * Fix lint * Fix lint - use only User and CrateUserCommand from user pkg * Remove User and CreateUserCommand from models * Fix lint 2
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package org
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Typed errors
|
||||
var (
|
||||
ErrOrgNotFound = errors.New("organization not found")
|
||||
ErrOrgNameTaken = errors.New("organization name is taken")
|
||||
)
|
||||
|
||||
type Org struct {
|
||||
ID int64 `xorm:"pk autoincr 'id'"`
|
||||
Version int
|
||||
Name string
|
||||
|
||||
Address1 string
|
||||
Address2 string
|
||||
City string
|
||||
ZipCode string
|
||||
State string
|
||||
Country string
|
||||
|
||||
Created time.Time
|
||||
Updated time.Time
|
||||
}
|
||||
type OrgUser struct {
|
||||
ID int64 `xorm:"pk autoincr 'id'"`
|
||||
OrgID int64 `xorm:"org_id"`
|
||||
UserID int64 `xorm:"user_id"`
|
||||
Role RoleType
|
||||
Created time.Time
|
||||
Updated time.Time
|
||||
}
|
||||
|
||||
// swagger:enum RoleType
|
||||
type RoleType string
|
||||
|
||||
const (
|
||||
ROLE_VIEWER RoleType = "Viewer"
|
||||
ROLE_EDITOR RoleType = "Editor"
|
||||
ROLE_ADMIN RoleType = "Admin"
|
||||
)
|
||||
|
||||
type CreateOrgCommand struct {
|
||||
Name string `json:"name" binding:"Required"`
|
||||
|
||||
// initial admin user for account
|
||||
UserID int64 `json:"-"`
|
||||
}
|
||||
|
||||
type GetOrgIDForNewUserCommand struct {
|
||||
Email string
|
||||
Login string
|
||||
OrgID int64
|
||||
OrgName string
|
||||
SkipOrgSetup bool
|
||||
}
|
||||
Reference in New Issue
Block a user