fixed permission_reposity queries
This commit is contained in:
@@ -100,7 +100,7 @@ func GetUserAttributes(userID string) (map[string]string, error) {
|
|||||||
func GetUserByID(userID string) (*models.User, error) {
|
func GetUserByID(userID string) (*models.User, error) {
|
||||||
query := `
|
query := `
|
||||||
SELECT user_id, first_name, middle_initial, last_name, suffix, email_address,
|
SELECT user_id, first_name, middle_initial, last_name, suffix, email_address,
|
||||||
emp_id, reg, prov, aProv, mun, bgy, is_logged_in,
|
emp_id, is_logged_in,
|
||||||
first_logged_in, home_address, contact_number, device_id, role_id, is_deleted, secret_key, is_activated, created_at, updated_at
|
first_logged_in, home_address, contact_number, device_id, role_id, is_deleted, secret_key, is_activated, created_at, updated_at
|
||||||
FROM uess_user_management.users
|
FROM uess_user_management.users
|
||||||
WHERE user_id = ? AND is_deleted = 'N'
|
WHERE user_id = ? AND is_deleted = 'N'
|
||||||
@@ -116,18 +116,12 @@ func GetUserByID(userID string) (*models.User, error) {
|
|||||||
&user.Suffix,
|
&user.Suffix,
|
||||||
&user.EmailAddress,
|
&user.EmailAddress,
|
||||||
&user.EmpID,
|
&user.EmpID,
|
||||||
&user.Reg,
|
|
||||||
&user.Prov,
|
|
||||||
&user.AProv,
|
|
||||||
&user.Mun,
|
|
||||||
&user.Bgy,
|
|
||||||
&user.IsLoggedIn,
|
&user.IsLoggedIn,
|
||||||
&user.FirstLoggedIn,
|
&user.FirstLoggedIn,
|
||||||
&user.HomeAddress,
|
&user.HomeAddress,
|
||||||
&user.ContactNumber,
|
&user.ContactNumber,
|
||||||
&user.DeviceID,
|
&user.DeviceID,
|
||||||
&user.RoleID,
|
&user.RoleID,
|
||||||
&user.RoleDPS,
|
|
||||||
&user.IsDeleted,
|
&user.IsDeleted,
|
||||||
&user.SecretKey,
|
&user.SecretKey,
|
||||||
&user.IsActivated,
|
&user.IsActivated,
|
||||||
|
|||||||
@@ -109,9 +109,8 @@ func TestGetUserByIDSuccess(t *testing.T) {
|
|||||||
|
|
||||||
rows := sqlmock.NewRows([]string{
|
rows := sqlmock.NewRows([]string{
|
||||||
"user_id", "first_name", "middle_initial", "last_name", "suffix", "email_address",
|
"user_id", "first_name", "middle_initial", "last_name", "suffix", "email_address",
|
||||||
"account_type", "emp_id", "reg", "prov", "aProv", "mun", "bgy", "is_logged_in",
|
"emp_id", "reg", "prov", "aProv", "mun", "bgy", "is_logged_in",
|
||||||
"first_logged_in", "address", "contact_number", "device_id", "role_id",
|
"first_logged_in", "address", "contact_number", "device_id", "role_id", "is_deleted", "secret_key", "is_activated", "created_at", "updated_at",
|
||||||
"role_dps", "is_deleted", "secret_key", "is_activated", "created_at", "updated_at",
|
|
||||||
}).AddRow(
|
}).AddRow(
|
||||||
"user123", "John", "M", "Doe", "Jr", "john@example.com",
|
"user123", "John", "M", "Doe", "Jr", "john@example.com",
|
||||||
"regular", "EMP001", "01", "02", "03", "04", "05", "Y",
|
"regular", "EMP001", "01", "02", "03", "04", "05", "Y",
|
||||||
@@ -319,7 +318,7 @@ func TestGetUserByIDEmptyID(t *testing.T) {
|
|||||||
"user_id", "first_name", "middle_initial", "last_name", "suffix", "email_address",
|
"user_id", "first_name", "middle_initial", "last_name", "suffix", "email_address",
|
||||||
"account_type", "emp_id", "reg", "prov", "aProv", "mun", "bgy", "is_logged_in",
|
"account_type", "emp_id", "reg", "prov", "aProv", "mun", "bgy", "is_logged_in",
|
||||||
"first_logged_in", "address", "contact_number", "device_id", "role_id",
|
"first_logged_in", "address", "contact_number", "device_id", "role_id",
|
||||||
"role_dps", "is_deleted", "secret_key", "is_activated", "created_at", "updated_at",
|
"is_deleted", "secret_key", "is_activated", "created_at", "updated_at",
|
||||||
})
|
})
|
||||||
|
|
||||||
// Match the actual query format with all the fields
|
// Match the actual query format with all the fields
|
||||||
|
|||||||
Reference in New Issue
Block a user