forked from zopsmart/ezgo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zopsmart#3 | added pagination and filter, only filter by skills remai…
…ning
- Loading branch information
Showing
11 changed files
with
317 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
mode: set | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:14.43,16.2 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:18.105,19.20 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:22.2,22.45 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:18.140,19.20 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:22.2,22.37 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:25.2,25.72 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:19.20,21.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:25.116,26.20 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:29.2,29.21 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:32.2,32.58 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:26.20,28.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:29.21,31.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:35.125,36.20 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:39.2,40.16 2 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:43.2,45.18 3 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:36.20,38.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:40.16,42.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:48.135,49.20 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:52.2,52.21 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:55.2,56.16 2 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:59.2,61.18 3 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:49.20,51.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:52.21,54.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:56.16,58.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:64.96,65.20 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:68.2,68.21 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:71.2,71.57 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:65.20,67.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:68.21,70.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:22.37,24.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:28.116,29.20 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:32.2,32.21 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:35.2,35.58 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:29.20,31.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:32.21,34.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:38.125,39.20 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:42.2,43.16 2 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:46.2,48.18 3 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:39.20,41.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:43.16,45.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:51.135,52.20 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:55.2,55.21 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:58.2,59.16 2 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:62.2,64.18 3 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:52.20,54.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:55.21,57.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:59.16,61.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:67.96,68.20 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:71.2,71.21 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:74.2,74.57 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:68.20,70.3 1 1 | ||
github.com/zopsmart/hiring-portal-api/panel/service/service.go:71.21,73.3 1 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,28 +41,61 @@ func testAllEmployeeService(t *testing.T, c *gofr.Context) { | |
input int | ||
expectedOutput []models.Employee | ||
expectedErr error | ||
queryParams map[string]interface{} | ||
}{ | ||
{ | ||
input: 1, | ||
expectedOutput: []models.Employee{{1, "Bittu", "[email protected]", 7250073079, "sde1", 2, 1}, | ||
{2, "Bittu Ray", "[email protected]", 7250073080, "sde2", 2, 1}, | ||
}, | ||
expectedErr: nil, | ||
queryParams: map[string]interface{}{ | ||
"yoe": 1, | ||
"designation": "sde", | ||
"page": 0, | ||
"limit": 10, | ||
"skills": []string{}, | ||
}, | ||
}, | ||
{ | ||
input: -1, | ||
expectedOutput: []models.Employee(nil), | ||
expectedErr: customeerror.ErrInvalidCompanyID, | ||
queryParams: map[string]interface{}{ | ||
"yoe": 1, | ||
"designation": "sde", | ||
"page": 0, | ||
"limit": 10, | ||
"skills": []string{}, | ||
}, | ||
}, | ||
{ | ||
input: 2, | ||
expectedErr: customeerror.ErrDBServer, | ||
queryParams: map[string]interface{}{ | ||
"yoe": 1, | ||
"designation": "sde", | ||
"page": 0, | ||
"limit": 10, | ||
"skills": []string{}, | ||
}, | ||
}, | ||
{ | ||
input: 2, | ||
expectedErr: customeerror.ErrDBServer, | ||
queryParams: map[string]interface{}{ | ||
"yoe": 1, | ||
"designation": "", | ||
"page": 0, | ||
"limit": 10, | ||
"skills": []string{}, | ||
}, | ||
}, | ||
} | ||
|
||
for i := range testCases { | ||
dataService := New(mockStore{}) | ||
output, err := dataService.GetAllEmployee(c, testCases[i].input) | ||
output, err := dataService.GetAllEmployee(c, testCases[i].input, testCases[i].queryParams) | ||
CheckErrOutput(t, testCases[i].expectedErr, err, testCases[i].expectedOutput, output) | ||
} | ||
} | ||
|
@@ -235,7 +268,19 @@ func testDeleteEmployeeService(t *testing.T, c *gofr.Context) { | |
type mockStore struct { | ||
} | ||
|
||
func (m mockStore) GetAllEmployee(c *gofr.Context, companyID int) ([]models.Employee, error) { | ||
func (m mockStore) GetAllEmployeeWithDesignation(c *gofr.Context, companyID int, queryParams map[string]interface{}) ([]models.Employee, error) { | ||
if companyID == 2 { | ||
return nil, customeerror.ErrDBServer | ||
} | ||
|
||
res := []models.Employee{{1, "Bittu", "[email protected]", 7250073079, "sde1", 2, 1}, | ||
{2, "Bittu Ray", "[email protected]", 7250073080, "sde2", 2, 1}, | ||
} | ||
|
||
return res, nil | ||
} | ||
|
||
func (m mockStore) GetAllEmployeeWithoutDesignation(c *gofr.Context, companyID int, queryParams map[string]interface{}) ([]models.Employee, error) { | ||
if companyID == 2 { | ||
return nil, customeerror.ErrDBServer | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.