user

package
v0.0.0-...-db28b0c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2023 License: Unlicense Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const EndPoint = "users"

Variables

This section is empty.

Functions

func Create

func Create(ctx *app.Ctx, param *ParamCreate) error

func CreateHandler

func CreateHandler(c *fiber.Ctx) error

func DeleteByID

func DeleteByID(ctx *app.Ctx, id string, param ParamDelete) error

func DeleteByIDHandler

func DeleteByIDHandler(c *fiber.Ctx) error

func Get

func Get(ctx *app.Ctx, query url.Values) (app.ListModel, error)

func GetByIDHandler

func GetByIDHandler(c *fiber.Ctx) error

func GetListHandler

func GetListHandler(c *fiber.Ctx) error

func PartialyUpdateByID

func PartialyUpdateByID(ctx *app.Ctx, id string, param *ParamPartialyUpdate) error

func PartialyUpdateByIDHandler

func PartialyUpdateByIDHandler(c *fiber.Ctx) error

func UpdateByID

func UpdateByID(ctx *app.Ctx, id string, param *ParamUpdate) error

func UpdateByIDHandler

func UpdateByIDHandler(c *fiber.Ctx) error

Types

type List

type List struct {
	app.ListModel
	Results []User `json:"results"`
}

type ParamCreate

type ParamCreate struct {
	User
	Username     db.NullString `json:"username"      db:"u.username"      gorm:"column:username"      validate:"required" form:"username"`
	FirstName    db.NullString `json:"firstname"     db:"u.first_name"    gorm:"column:first_name"    validate:"required" form:"firstname"`
	Email        db.NullString `json:"email"         db:"u.email"         gorm:"column:email"         validate:"required" form:"email"`
	LdapUsername db.NullString `json:"ldap_username" db:"u.ldap_username" gorm:"column:ldap_username" validate:"required" form:"ldap_username"`
	Roles        []UserRoles   `json:"roles"         db:"ug.user_id=id"   gorm:"-"                    validate:"required" form:"roles"`
}

type ParamDelete

type ParamDelete struct {
	User
	Reason db.NullString `json:"reason" gorm:"-" validate:"required" form:"reason"`
}

type ParamPartialyUpdate

type ParamPartialyUpdate struct {
	User
	Reason db.NullString `json:"reason" gorm:"-" validate:"required" form:"reason"`
}

type ParamUpdate

type ParamUpdate struct {
	ParamCreate
	Reason db.NullString `json:"reason" gorm:"-" validate:"required" form:"reason"`
}

type User

type User struct {
	db.Model
	ID                    db.NullInt64          `json:"id"                      db:"u.id"                   gorm:"column:id"               form:"id"`
	Username              db.NullString         `json:"username"                db:"u.username"             gorm:"column:username"         form:"username"`
	JobTitle              db.NullString         `json:"jobtitle"                db:"u.job_title"            gorm:"column:job_title"        form:"jobtitle"`
	IpAddress             db.NullString         `json:"ipaddress"               db:"u.ip_address"           gorm:"column:ip_address"       form:"ipaddress"`
	CreatedOn             db.NullInt64          `json:"created"                 db:"u.created_on"           gorm:"column:created_on"       form:"created"`
	LastLogin             db.NullInt64          `json:"last_login"              db:"u.last_login"           gorm:"column:last_login"       form:"last_login"`
	Active                db.NullBool           `json:"active"                  db:"u.active"               gorm:"column:active"           form:"active"`
	FirstName             db.NullString         `json:"firstname"               db:"u.first_name"           gorm:"column:first_name"       form:"firstname"`
	LastName              db.NullString         `json:"lastname"                db:"u.last_name"            gorm:"column:last_name"        form:"lastname"`
	Phone                 db.NullString         `json:"phone"                   db:"u.phone"                gorm:"column:phone"            form:"phone"`
	PictureUrl            db.NullString         `json:"picture"                 db:"u.picture"              gorm:"column:picture"          form:"-"`
	PictureFileName       db.NullString         `json:"picture_filename"        db:"u.picture_filename"     gorm:"column:picture_filename" form:"-"`
	File                  *multipart.FileHeader `json:"-"                       db:"-"                      gorm:"-"                       form:"picture"`
	ParentPmkId           db.NullInt64          `json:"parent_jabatan.id"       db:"u.staff_pmk_id"         gorm:"column:staff_pmk_id"     form:"parent_jabatan[id]"`
	ParentPmkName         db.NullString         `json:"parent_jabatan.name"     db:"pj.pmk_nama"            gorm:"-"                       form:"parent_jabatan.name"`
	JabatanUtamaID        db.NullInt64          `json:"jabatan_utama.id"        db:"ju.pmk_id"              gorm:"-"                       form:"jabatan_utama[id]"`
	JabatanUtamaName      db.NullString         `json:"jabatan_utama.name"      db:"ju.pmk_nama"            gorm:"-"                       form:"jabatan_utama.name"`
	SekretarisJabatanID   db.NullInt64          `json:"jabatan_sekretaris.id"   db:"js.pmk_id"              gorm:"-"                       form:"jabatan_sekretaris[id]"`
	SekretarisJabatanName db.NullString         `json:"jabatan_sekretaris.name" db:"js.pmk_nama"            gorm:"-"                       form:"jabatan_sekretaris.name"`
	PLT                   []UserPLT             `json:"plt"                     db:"plt.pmk_plt_user_id=id" gorm:"-"                       form:"-"`
	Email                 db.NullString         `json:"email"                   db:"u.email"                gorm:"column:email"            form:"email"`
	LdapUsername          db.NullString         `json:"ldap_username"           db:"u.ldap_username"        gorm:"column:ldap_username"    form:"ldap_username"`
	TokenMobile           db.NullText           `json:"token_mobile"            db:"u.token_mobile"         gorm:"column:token_mobile"     form:"token_mobile"`
	NIK                   db.NullString         `json:"nik"                     db:"u.nik"                  gorm:"column:nik"              form:"nik"`
	Roles                 []UserRoles           `json:"roles"                   db:"ug.user_id=id"          gorm:"-"                       form:"roles"`
	ACL                   map[string]bool       `json:"acl"                     db:"-"                      gorm:"-"                       form:"acl"`
}

func GetByID

func GetByID(ctx *app.Ctx, id string, query url.Values) (User, error)

func (*User) SetFilter

func (u *User) SetFilter()

func (*User) SetRelation

func (u *User) SetRelation()

func (*User) SetSort

func (u *User) SetSort()

func (User) TableAliasName

func (User) TableAliasName() string

func (User) TableName

func (User) TableName() string

func (User) TableVersion

func (User) TableVersion() string

type UserPLT

type UserPLT struct {
	db.Model
	ID     db.NullInt64  `json:"id"   db:"plt.pmk_id"          gorm:"column:pmk_id;primaryKey" form:"id"`
	UserID db.NullInt64  `json:"-"    db:"plt.pmk_plt_user_id" gorm:"column:pmk_plt_user_id"   form:"-"`
	Name   db.NullString `json:"name" db:"plt.pmk_nama"        gorm:"column:pmk_nama"          form:"name"`
}

func (UserPLT) TableAliasName

func (UserPLT) TableAliasName() string

func (UserPLT) TableName

func (UserPLT) TableName() string

type UserRoles

type UserRoles struct {
	db.Model
	ID          db.NullInt64  `json:"-"           db:"ug.id"           gorm:"column:id;primaryKey" form:"-"`
	UserID      db.NullInt64  `json:"-"           db:"ug.user_id"      gorm:"column:user_id"       form:"-"`
	RoleID      db.NullInt64  `json:"id"          db:"ug.group_id"     gorm:"column:group_id"      form:"id"`
	Name        db.NullString `json:"name"        db:"g.name"          gorm:"-"                    form:"name"`
	Description db.NullString `json:"description" db:"g.description"   gorm:"-"                    form:"description"`
	IsAdmin     db.NullBool   `json:"is_admin"    db:"g.is_admin"      gorm:"-"                    form:"is_admin"`
	ACL         roles.AclKeys `json:"-"           db:"g.acl_keys~json" gorm:"-"                    form:"-"`
}

func (*UserRoles) SetRelation

func (au *UserRoles) SetRelation()

func (UserRoles) TableAliasName

func (UserRoles) TableAliasName() string

func (UserRoles) TableName

func (UserRoles) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL