...
|
...
|
@@ -21,16 +21,18 @@ func NewUserRepository(tx *pgTransaction.TransactionContext) *UserRepository { |
|
|
|
|
|
func (repo *UserRepository) Insert(user *domain.User) (*domain.User, error) {
|
|
|
userModel := models.User{
|
|
|
Id: user.Id,
|
|
|
Account: user.Account,
|
|
|
AvatarUrl: user.AvatarUrl,
|
|
|
CompanyId: user.CompanyId,
|
|
|
AdminType: user.AdminType,
|
|
|
Name: user.Name,
|
|
|
Status: user.Status,
|
|
|
UpdatedAt: user.UpdatedAt,
|
|
|
CreatedAt: user.CreatedAt,
|
|
|
DeletedAt: user.DeletedAt,
|
|
|
Id: user.Id,
|
|
|
Account: user.Account,
|
|
|
AvatarUrl: user.AvatarUrl,
|
|
|
CompanyId: user.CompanyId,
|
|
|
AdminType: user.AdminType,
|
|
|
DepartmentId: user.DepartmentId,
|
|
|
PositionId: user.PositionId,
|
|
|
Name: user.Name,
|
|
|
Status: user.Status,
|
|
|
UpdatedAt: user.UpdatedAt,
|
|
|
CreatedAt: user.CreatedAt,
|
|
|
DeletedAt: user.DeletedAt,
|
|
|
}
|
|
|
tx := repo.transactionContext.PgTx
|
|
|
_, err := tx.Model(&userModel).Insert()
|
...
|
...
|
@@ -43,17 +45,19 @@ func (repo *UserRepository) Insert(user *domain.User) (*domain.User, error) { |
|
|
|
|
|
func (repo *UserRepository) Update(user *domain.User) (*domain.User, error) {
|
|
|
userModel := models.User{
|
|
|
Id: user.Id,
|
|
|
Account: user.Account,
|
|
|
AvatarUrl: user.AvatarUrl,
|
|
|
CompanyId: user.CompanyId,
|
|
|
AdminType: user.AdminType,
|
|
|
Name: user.Name,
|
|
|
Email: user.Email,
|
|
|
Status: user.Status,
|
|
|
UpdatedAt: user.UpdatedAt,
|
|
|
CreatedAt: user.CreatedAt,
|
|
|
DeletedAt: user.DeletedAt,
|
|
|
Id: user.Id,
|
|
|
Account: user.Account,
|
|
|
AvatarUrl: user.AvatarUrl,
|
|
|
CompanyId: user.CompanyId,
|
|
|
AdminType: user.AdminType,
|
|
|
DepartmentId: user.DepartmentId,
|
|
|
PositionId: user.PositionId,
|
|
|
Name: user.Name,
|
|
|
Email: user.Email,
|
|
|
Status: user.Status,
|
|
|
UpdatedAt: user.UpdatedAt,
|
|
|
CreatedAt: user.CreatedAt,
|
|
|
DeletedAt: user.DeletedAt,
|
|
|
}
|
|
|
tx := repo.transactionContext.PgTx
|
|
|
_, err := tx.Model(&userModel).WherePK().Update()
|
...
|
...
|
|