From 1b9b32b380922beab927fa8155d353b86625ddb1 Mon Sep 17 00:00:00 2001 From: raybittu Date: Fri, 12 Feb 2021 17:23:11 +0530 Subject: [PATCH 01/10] added .DS_Store in gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 127ee313..f112e0ad 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ # Test binary, built with `go test -c` *.test +./.DS_Store +.DS_Store # Output of the go coverage tool, specifically when used with LiteIDE *.out From 52ae0adf04cbbca5468315beb896dcb380eeb9df Mon Sep 17 00:00:00 2001 From: raybittu Date: Mon, 15 Feb 2021 13:01:46 +0530 Subject: [PATCH 02/10] #3 | added pagination and filter, only filter by skills remaining --- .DS_Store | Bin 6148 -> 6148 bytes panel.zip | Bin 0 -> 15644 bytes panel/http/http.go | 22 ++++- panel/service/coverage.txt | 50 +++++----- panel/service/interface.go | 2 +- panel/service/service.go | 7 +- panel/service/service_test.go | 49 +++++++++- panel/store/coverage.txt | 53 ++++++----- panel/store/interface.go | 3 +- panel/store/store.go | 29 +++++- panel/store/store_test.go | 168 ++++++++++++++++++++++++++++++++-- 11 files changed, 317 insertions(+), 66 deletions(-) create mode 100644 panel.zip diff --git a/.DS_Store b/.DS_Store index 60d43a904a8a58f551c6bada4e745c30afb7df95..cb98ecdc4912abf077d2d4c96a2c673f8ea00533 100644 GIT binary patch delta 120 zcmZoMXfc@J&&abeU^g=(&tx8!Ojafa7Y3)vaxC(jOIg-4>J~60GUPF&GUPDmF;p>R zG8A~`TPvOFbFU(FtPyYm;b?lfnl;do2fVtLoq`+P**w-rZN-(^;H6SxszE~ P6*rctGHzz)_{$FfUg;l` delta 36 scmZoMXfc@J&&atkU^g=(=VTt1%*``d)-z77Vl&uSwwZA=JI7ys0N9ia6951J diff --git a/panel.zip b/panel.zip new file mode 100644 index 0000000000000000000000000000000000000000..86a1d48a247d6c52f232d9aa883a022cae6503a9 GIT binary patch literal 15644 zcmbt*1z40z`#wl_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1 zC^RfGrXC=jH|vktzgpBt8>*Q``>HU?>~Y|-QH&cG^hKk;AA-Q zLxon<)>mSq;P^2{9J*kSn528wX_**gM`s=Q<5d;L7;A!B)g8?#UP4<6;Dl62c$0GK zmb)oQAx-;g<2Ps`CQpfOFopy#YX!Pp_9`9K3-b7(r||0(hQFY8(ltl%LAo5&5L$+d zY*w_vfX;rbG=M8Gfg9SmKFSY|FY%Cx@JS`0Ov^sfCKaUM>q~~90zr9wc+~9#R0|TQ z`W~(*Bd-}!4y#SIP0IA)Mr^KtY8w@c-1vgrW zEL8Zxi^Ua%H&0yjYZ zKtH&XdB@zm|8xNGX_C8^?IZME=09nz|3x@Z$bC=&{|B;x@7g~9t6Kp6W$+zI^gAo* z50ub5!+|n>l?{C0;I8fS&wiKvKRXtF{mrMUwp53py?$gbHETy}a?E{bei?08b6!)u&`_wLA@o?9& zeVTt&@h@0xziPQp#QHgCHMix=?}PU3+q*^5zsTD6`BFaz%?kAwUH?$=hf|1O-MLSX z`Wa}9Xm={UQ=Avxfhlj=x`j{;VbO c$BxBvhE literal 0 HcmV?d00001 diff --git a/panel/http/http.go b/panel/http/http.go index 615ba05e..1d9136c5 100644 --- a/panel/http/http.go +++ b/panel/http/http.go @@ -46,7 +46,27 @@ func (p PanelHTTP) GetAllEmployee(c *gofr.Context) (interface{}, error) { return "Invalid CompanyID", customeerror.ErrInvalidCompanyID } - res, err := p.service.GetAllEmployee(c, companyID) + yoe, _ := strconv.Atoi(c.Param("yoe")) + designation := c.Param("designation") + page, err := strconv.Atoi(c.Param("page")) + if err != nil { + page = 1 + } + limit, err := strconv.Atoi(c.Param("limit")) + if err != nil { + limit = 20 + } + skills := []string{} + + queryParams := map[string]interface{}{ + "yoe": yoe, + "designation": designation, + "page": (page - 1) * limit, + "limit": limit, + "skills": skills, + } + + res, err := p.service.GetAllEmployee(c, companyID, queryParams) if err != nil { return nil, err } diff --git a/panel/service/coverage.txt b/panel/service/coverage.txt index f40eed11..98d8f90f 100644 --- a/panel/service/coverage.txt +++ b/panel/service/coverage.txt @@ -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 diff --git a/panel/service/interface.go b/panel/service/interface.go index 191cfc33..a9c88e09 100644 --- a/panel/service/interface.go +++ b/panel/service/interface.go @@ -6,7 +6,7 @@ import ( ) type PanelEmployee interface { - GetAllEmployee(*gofr.Context, int) ([]models.Employee, error) + GetAllEmployee(*gofr.Context, int, map[string]interface{}) ([]models.Employee, error) GetEmployeeByID(*gofr.Context, int, int) (models.Employee, error) CreateEmployee(*gofr.Context, int, *models.Employee) (models.Employee, error) EditEmployee(*gofr.Context, int, int, *models.Employee) (models.Employee, error) diff --git a/panel/service/service.go b/panel/service/service.go index ca8d230c..9c78059b 100644 --- a/panel/service/service.go +++ b/panel/service/service.go @@ -15,11 +15,14 @@ func New(store store.Panel) PanelEmployee { return PanelEmployeeService{store: store} } -func (p PanelEmployeeService) GetAllEmployee(c *gofr.Context, companyID int) ([]models.Employee, error) { +func (p PanelEmployeeService) GetAllEmployee(c *gofr.Context, companyID int, queryParam map[string]interface{}) ([]models.Employee, error) { if companyID <= 0 { return nil, customeerror.ErrInvalidCompanyID } - return p.store.GetAllEmployee(c, companyID) + if queryParam["designation"] == "" { + return p.store.GetAllEmployeeWithoutDesignation(c, companyID, queryParam) + } + return p.store.GetAllEmployeeWithDesignation(c, companyID, queryParam) } func (p PanelEmployeeService) GetEmployeeByID(c *gofr.Context, companyID, employeeID int) (models.Employee, error) { diff --git a/panel/service/service_test.go b/panel/service/service_test.go index 00a4f8be..d9e0c0d1 100644 --- a/panel/service/service_test.go +++ b/panel/service/service_test.go @@ -41,6 +41,7 @@ func testAllEmployeeService(t *testing.T, c *gofr.Context) { input int expectedOutput []models.Employee expectedErr error + queryParams map[string]interface{} }{ { input: 1, @@ -48,21 +49,53 @@ func testAllEmployeeService(t *testing.T, c *gofr.Context) { {2, "Bittu Ray", "bitturay@gmail.com", 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", "bittu@gmail.com", 7250073079, "sde1", 2, 1}, + {2, "Bittu Ray", "bitturay@gmail.com", 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 } diff --git a/panel/store/coverage.txt b/panel/store/coverage.txt index fc22581a..fc4fed50 100644 --- a/panel/store/coverage.txt +++ b/panel/store/coverage.txt @@ -1,6 +1,6 @@ mode: set github.com/zopsmart/hiring-portal-api/panel/store/store.go:11.18,13.2 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:15.95,20.16 5 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:15.146,20.16 5 1 github.com/zopsmart/hiring-portal-api/panel/store/store.go:23.2,25.18 3 1 github.com/zopsmart/hiring-portal-api/panel/store/store.go:32.2,32.19 1 1 github.com/zopsmart/hiring-portal-api/panel/store/store.go:35.2,35.17 1 1 @@ -9,26 +9,35 @@ github.com/zopsmart/hiring-portal-api/panel/store/store.go:25.18,27.109 2 1 github.com/zopsmart/hiring-portal-api/panel/store/store.go:30.3,30.23 1 1 github.com/zopsmart/hiring-portal-api/panel/store/store.go:27.109,29.4 1 1 github.com/zopsmart/hiring-portal-api/panel/store/store.go:32.19,34.3 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:38.106,43.16 5 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:38.149,43.16 5 1 github.com/zopsmart/hiring-portal-api/panel/store/store.go:46.2,48.18 3 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:53.2,53.17 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:57.2,57.17 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:55.2,55.19 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:58.2,58.17 1 1 github.com/zopsmart/hiring-portal-api/panel/store/store.go:43.16,45.3 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:48.18,49.123 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:49.123,51.4 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:53.17,56.3 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:60.103,65.16 5 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:68.2,69.14 2 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:72.2,72.21 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:65.16,67.3 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:69.14,71.3 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:75.113,80.16 5 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:83.2,84.13 2 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:87.2,87.21 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:80.16,82.3 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:84.13,86.3 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:90.86,94.16 4 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:98.2,99.12 2 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:103.2,103.12 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:94.16,97.3 1 1 -github.com/zopsmart/hiring-portal-api/panel/store/store.go:99.12,102.3 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:48.18,50.109 2 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:53.3,53.23 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:50.109,52.4 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:55.19,57.3 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:61.106,66.16 5 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:69.2,71.18 3 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:76.2,76.17 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:80.2,80.17 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:66.16,68.3 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:71.18,72.123 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:72.123,74.4 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:76.17,79.3 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:83.103,88.16 5 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:91.2,92.14 2 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:95.2,95.21 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:88.16,90.3 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:92.14,94.3 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:98.113,103.16 5 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:106.2,107.13 2 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:110.2,110.21 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:103.16,105.3 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:107.13,109.3 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:113.86,117.16 4 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:121.2,122.12 2 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:126.2,126.12 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:117.16,120.3 1 1 +github.com/zopsmart/hiring-portal-api/panel/store/store.go:122.12,125.3 1 1 diff --git a/panel/store/interface.go b/panel/store/interface.go index 8e2ba0be..124d7404 100644 --- a/panel/store/interface.go +++ b/panel/store/interface.go @@ -6,7 +6,8 @@ import ( ) type Panel interface { - GetAllEmployee(*gofr.Context, int) ([]models.Employee, error) + GetAllEmployeeWithDesignation(*gofr.Context, int, map[string]interface{}) ([]models.Employee, error) + GetAllEmployeeWithoutDesignation(*gofr.Context, int, map[string]interface{}) ([]models.Employee, error) GetEmployeeByID(*gofr.Context, int, int) (models.Employee, error) CreateEmployee(*gofr.Context, int, *models.Employee) (int, error) EditEmployee(*gofr.Context, int, int, *models.Employee) (int, error) diff --git a/panel/store/store.go b/panel/store/store.go index 9a87672c..45a1fa5b 100644 --- a/panel/store/store.go +++ b/panel/store/store.go @@ -12,10 +12,33 @@ func New() Panel { return PanelStore{} } -func (p PanelStore) GetAllEmployee(c *gofr.Context, companyID int) ([]models.Employee, error) { - const query = "select * from employee where company_id=? order by id, company_id asc" +func (p PanelStore) GetAllEmployeeWithDesignation(c *gofr.Context, companyID int, queryParams map[string]interface{}) ([]models.Employee, error) { + const query = "select * from employee where company_id=? and designation=? and yoe>=? order by id desc limit ?,?" var inputInterface []interface{} - inputInterface = append(inputInterface, companyID) + inputInterface = append(inputInterface, companyID, queryParams["designation"], queryParams["yoe"], queryParams["page"], queryParams["limit"]) + rows, err := c.DB.Query(query, inputInterface...) + if err != nil { + return nil, customeerror.ErrDBServer + } + defer rows.Close() + var res []models.Employee + for rows.Next() { + var e models.Employee + if err := rows.Scan(&e.ID, &e.Name, &e.Email, &e.Phone, &e.Designation, &e.YOE, &e.CompanyID); err != nil { + return nil, customeerror.ErrDBServer + } + res = append(res, e) + } + if len(res) == 0 { + return res, customeerror.ErrRecordNotFound + } + return res, nil +} + +func (p PanelStore) GetAllEmployeeWithoutDesignation(c *gofr.Context, companyID int, queryParams map[string]interface{}) ([]models.Employee, error) { + const query = "select * from employee where company_id=? and yoe>=? order by id desc limit ?,?" + var inputInterface []interface{} + inputInterface = append(inputInterface, companyID, queryParams["yoe"], queryParams["page"], queryParams["limit"]) rows, err := c.DB.Query(query, inputInterface...) if err != nil { return nil, customeerror.ErrDBServer diff --git a/panel/store/store_test.go b/panel/store/store_test.go index f33c8649..6a66efcb 100644 --- a/panel/store/store_test.go +++ b/panel/store/store_test.go @@ -26,7 +26,7 @@ func CheckErrOutput(t *testing.T, expectedErr, actualErr, expectedOutput, actual } } -func TestGetAllEmployeeMock(t *testing.T) { +func TestGetAllEmployeeWithDesignationMock(t *testing.T) { db, mock, err := sqlmock.New() if err != nil { fmt.Println(err) @@ -41,6 +41,7 @@ func TestGetAllEmployeeMock(t *testing.T) { input int expectedOutput []models.Employee expectedErr error + queryParams map[string]interface{} }{ { input: 1, @@ -49,23 +50,170 @@ func TestGetAllEmployeeMock(t *testing.T) { {2, "Bittu Ray", "bitturay@gmail.com", 7250073080, "sde2", 2, 1}, }, expectedErr: nil, + queryParams: map[string]interface{}{ + "yoe": 1, + "designation": "sde", + "page": 0, + "limit": 10, + "skills": []string{}, + }, + }, + + { + input: 2, + expectedOutput: []models.Employee(nil), + expectedErr: customeerror.ErrDBServer, + queryParams: map[string]interface{}{ + "yoe": 1, + "designation": "sde", + "page": 0, + "limit": 10, + "skills": []string{}, + }, + }, + { + input: 3, + expectedOutput: []models.Employee(nil), + expectedErr: customeerror.ErrRecordNotFound, + queryParams: map[string]interface{}{ + "yoe": 1, + "designation": "sde", + "page": 0, + "limit": 10, + "skills": []string{}, + }, + }, + + { + input: 4, + expectedOutput: []models.Employee(nil), + expectedErr: customeerror.ErrDBServer, + queryParams: map[string]interface{}{ + "yoe": 1, + "designation": "sde", + "page": 0, + "limit": 10, + "skills": []string{}, + }, + }, + } + + for i := range testCases { + var output, err interface{} + + if i == 3 { + table := []string{"id", "name", "email", "phone", "designation", "yoe"} + query := "select * from employee where companyid=? and designation=? and yoe>=? order by id desc limit ?,?" + rows := sqlmock.NewRows(table) + for j := range testCases[i].expectedOutput { + rows.AddRow(testCases[i].expectedOutput[j].ID, testCases[i].expectedOutput[j].Name, + testCases[i].expectedOutput[j].Email, testCases[i].expectedOutput[j].Phone, + testCases[i].expectedOutput[j].Designation, testCases[i].expectedOutput[j].YOE, + testCases[i].expectedOutput[j].CompanyID) + } + + mock.ExpectQuery(regexp.QuoteMeta(query)).WithArgs(testCases[i].input, testCases[i].queryParams["designation"], testCases[i].queryParams["yoe"], testCases[i].queryParams["page"], testCases[i].queryParams["limit"]).WillReturnRows(rows) + output, err = dataStore.GetAllEmployeeWithDesignation(c, testCases[i].input, testCases[i].queryParams) + } else if i == 1 { + table := []string{"id", "name", "email", "phone", "designation", "company_id"} + query := "select * from employee where company_id=? and designation=? and yoe>=? order by id desc limit ?,?" + rows := sqlmock.NewRows(table) + + rows.AddRow(2, "Bittu Ray", "bitturay@gmail.com", 7250073080, "sde2", 2) + + mock.ExpectQuery(regexp.QuoteMeta(query)).WithArgs(testCases[i].input, testCases[i].queryParams["designation"], testCases[i].queryParams["yoe"], testCases[i].queryParams["page"], testCases[i].queryParams["limit"]).WillReturnRows(rows) + output, err = dataStore.GetAllEmployeeWithDesignation(c, testCases[i].input, testCases[i].queryParams) + } else { + table := []string{"id", "name", "email", "phone", "designation", "yoe", "company_id"} + query := "select * from employee where company_id=? and designation=? and yoe>=? order by id desc limit ?,?" + rows := sqlmock.NewRows(table) + for j := range testCases[i].expectedOutput { + rows.AddRow(testCases[i].expectedOutput[j].ID, testCases[i].expectedOutput[j].Name, + testCases[i].expectedOutput[j].Email, testCases[i].expectedOutput[j].Phone, + testCases[i].expectedOutput[j].Designation, testCases[i].expectedOutput[j].YOE, + testCases[i].expectedOutput[j].CompanyID) + } + + mock.ExpectQuery(regexp.QuoteMeta(query)).WithArgs(testCases[i].input, testCases[i].queryParams["designation"], testCases[i].queryParams["yoe"], testCases[i].queryParams["page"], testCases[i].queryParams["limit"]).WillReturnRows(rows) + output, err = dataStore.GetAllEmployeeWithDesignation(c, testCases[i].input, testCases[i].queryParams) + + if err := mock.ExpectationsWereMet(); err != nil { + t.Errorf("there were unfulfilled expectations: %s", err) + } + } + CheckErrOutput(t, testCases[i].expectedErr, err, testCases[i].expectedOutput, output) + } +} + +func TestGetAllEmployeeWithoutDesignationMock(t *testing.T) { + db, mock, err := sqlmock.New() + if err != nil { + fmt.Println(err) + } + c := &gofr.Context{Container: &gofr.Container{ + Logger: logging.NewLogger(logging.DEBUG), + DB: &gofr.DB{db}, + }} + + dataStore := New() + testCases := []struct { + input int + expectedOutput []models.Employee + expectedErr error + queryParams map[string]interface{} + }{ + { + input: 1, + expectedOutput: []models.Employee{ + {1, "Bittu", "bittu@gmail.com", 7250073079, "sde1", 2, 1}, + {2, "Bittu Ray", "bitturay@gmail.com", 7250073080, "sde2", 2, 1}, + }, + expectedErr: nil, + queryParams: map[string]interface{}{ + "yoe": 1, + "designation": "sde", + "page": 0, + "limit": 10, + "skills": []string{}, + }, }, { input: 2, expectedOutput: []models.Employee(nil), expectedErr: customeerror.ErrDBServer, + queryParams: map[string]interface{}{ + "yoe": 1, + "designation": "sde", + "page": 0, + "limit": 10, + "skills": []string{}, + }, }, { input: 3, expectedOutput: []models.Employee(nil), expectedErr: customeerror.ErrRecordNotFound, + queryParams: map[string]interface{}{ + "yoe": 1, + "designation": "sde", + "page": 0, + "limit": 10, + "skills": []string{}, + }, }, { input: 4, expectedOutput: []models.Employee(nil), expectedErr: customeerror.ErrDBServer, + queryParams: map[string]interface{}{ + "yoe": 1, + "designation": "sde", + "page": 0, + "limit": 10, + "skills": []string{}, + }, }, } @@ -74,7 +222,7 @@ func TestGetAllEmployeeMock(t *testing.T) { if i == 3 { table := []string{"id", "name", "email", "phone", "designation", "yoe"} - query := "select * from employee where companyd=? order by id, company_id asc" + query := "select * from employee where companyid=? and yoe>=? order by id desc limit ?,?" rows := sqlmock.NewRows(table) for j := range testCases[i].expectedOutput { rows.AddRow(testCases[i].expectedOutput[j].ID, testCases[i].expectedOutput[j].Name, @@ -83,20 +231,20 @@ func TestGetAllEmployeeMock(t *testing.T) { testCases[i].expectedOutput[j].CompanyID) } - mock.ExpectQuery(regexp.QuoteMeta(query)).WithArgs(testCases[i].input).WillReturnRows(rows) - output, err = dataStore.GetAllEmployee(c, testCases[i].input) + mock.ExpectQuery(regexp.QuoteMeta(query)).WithArgs(testCases[i].input, testCases[i].queryParams["yoe"], testCases[i].queryParams["page"], testCases[i].queryParams["limit"]).WillReturnRows(rows) + output, err = dataStore.GetAllEmployeeWithoutDesignation(c, testCases[i].input, testCases[i].queryParams) } else if i == 1 { table := []string{"id", "name", "email", "phone", "designation", "company_id"} - query := "select * from employee where company_id=? order by id, company_id asc" + query := "select * from employee where company_id=? and yoe>=? order by id desc limit ?,?" rows := sqlmock.NewRows(table) rows.AddRow(2, "Bittu Ray", "bitturay@gmail.com", 7250073080, "sde2", 2) - mock.ExpectQuery(regexp.QuoteMeta(query)).WithArgs(testCases[i].input).WillReturnRows(rows) - output, err = dataStore.GetAllEmployee(c, testCases[i].input) + mock.ExpectQuery(regexp.QuoteMeta(query)).WithArgs(testCases[i].input, testCases[i].queryParams["yoe"], testCases[i].queryParams["page"], testCases[i].queryParams["limit"]).WillReturnRows(rows) + output, err = dataStore.GetAllEmployeeWithoutDesignation(c, testCases[i].input, testCases[i].queryParams) } else { table := []string{"id", "name", "email", "phone", "designation", "yoe", "company_id"} - query := "select * from employee where company_id=? order by id, company_id asc" + query := "select * from employee where company_id=? and yoe>=? order by id desc limit ?,?" rows := sqlmock.NewRows(table) for j := range testCases[i].expectedOutput { rows.AddRow(testCases[i].expectedOutput[j].ID, testCases[i].expectedOutput[j].Name, @@ -105,8 +253,8 @@ func TestGetAllEmployeeMock(t *testing.T) { testCases[i].expectedOutput[j].CompanyID) } - mock.ExpectQuery(regexp.QuoteMeta(query)).WithArgs(testCases[i].input).WillReturnRows(rows) - output, err = dataStore.GetAllEmployee(c, testCases[i].input) + mock.ExpectQuery(regexp.QuoteMeta(query)).WithArgs(testCases[i].input, testCases[i].queryParams["yoe"], testCases[i].queryParams["page"], testCases[i].queryParams["limit"]).WillReturnRows(rows) + output, err = dataStore.GetAllEmployeeWithoutDesignation(c, testCases[i].input, testCases[i].queryParams) if err := mock.ExpectationsWereMet(); err != nil { t.Errorf("there were unfulfilled expectations: %s", err) From 87c49e136bed652c68045a3ccf3a2fa9d9c7990f Mon Sep 17 00:00:00 2001 From: raybittu Date: Mon, 15 Feb 2021 13:27:08 +0530 Subject: [PATCH 03/10] #3 | .DS_Store deleted and filter added --- .DS_Store | Bin 6148 -> 0 bytes panel/http/http_test.go | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index cb98ecdc4912abf077d2d4c96a2c673f8ea00533..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKO>Pr06n;+AW)gzP0;yfj28l(45<%#qLW)9IbcYlK3qb8mXJ|*7jHAq?p$$RV za0lQ99EB5b2G$$^zGu5-GHI0^Lf|LapU3{*bNu-)CL+dj?%2v`X)*n<;|^%dJ!do zoc81-2~rhjpc@>g>QoOJJF{7*-EO*_c4yvnXS=(tru*Rj!}+}GY~N`=+CLngozLFQ z-+#hzU;>A?vRei(;4=z2F-`~LB$mlBYT2XuTPDbQ4tYlfxyoRD&rMksOD2T00j7hO z&9FGh;s-qP6IZ8{rfQk-LL0;93}3^w6N50;)+u17-MO)jXxpsRrR@8eC}9?j+3PLzte0 zd7%i^JL0>FPNJ*P=2ii#z_J1x`m@3J|C8(A|I1GH%PL?M_@@*Q<^G`G!;s9~x-vMv vYh9#6BsS(PG%6Ql<~mjdzKVB{l%dV#0 Date: Mon, 15 Feb 2021 14:51:29 +0530 Subject: [PATCH 04/10] #3 | Update schema.sql, change contraint skill_id to emp_skill_id --- db/schema.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/schema.sql b/db/schema.sql index 767983ed..ac2327f1 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -107,7 +107,7 @@ CREATE TABLE `skillsEmployees` ( PRIMARY KEY (`employee_id`,`skill_id`), KEY `skill_id_idx` (`skill_id`), CONSTRAINT `employee_id` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`), - CONSTRAINT `skill_id` FOREIGN KEY (`skill_id`) REFERENCES `skills` (`id`) + CONSTRAINT `emp_skill_id` FOREIGN KEY (`skill_id`) REFERENCES `skills` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; From ca3f5dae57b2c55c2a43e08b4fc91d9bf1cd8151 Mon Sep 17 00:00:00 2001 From: raybittu Date: Mon, 15 Feb 2021 15:13:51 +0530 Subject: [PATCH 05/10] #3 database constraint in skill_employe table corrected --- panel/store/store.go | 12 ++++++------ panel/store/store_test.go | 30 +++++++++++++++--------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/panel/store/store.go b/panel/store/store.go index f929b334..38f609dd 100644 --- a/panel/store/store.go +++ b/panel/store/store.go @@ -13,7 +13,7 @@ func New() Panel { } func (p PanelStore) GetAllEmployeeWithDesignation(c *gofr.Context, companyID int, queryParams map[string]interface{}) ([]models.Employee, error) { - const query = "select * from employee where company_id=? and designation=? and yoe>=? order by id desc limit ?,?" + const query = "select * from employees where company_id=? and designation=? and yoe>=? order by id desc limit ?,?" var inputInterface []interface{} inputInterface = append(inputInterface, companyID, queryParams["designation"], queryParams["yoe"], queryParams["page"], queryParams["limit"]) rows, err := c.DB.Query(query, inputInterface...) @@ -36,7 +36,7 @@ func (p PanelStore) GetAllEmployeeWithDesignation(c *gofr.Context, companyID int } func (p PanelStore) GetAllEmployeeWithoutDesignation(c *gofr.Context, companyID int, queryParams map[string]interface{}) ([]models.Employee, error) { - const query = "select * from employee where company_id=? and yoe>=? order by id desc limit ?,?" + const query = "select * from employees where company_id=? and yoe>=? order by id desc limit ?,?" var inputInterface []interface{} inputInterface = append(inputInterface, companyID, queryParams["yoe"], queryParams["page"], queryParams["limit"]) rows, err := c.DB.Query(query, inputInterface...) @@ -59,7 +59,7 @@ func (p PanelStore) GetAllEmployeeWithoutDesignation(c *gofr.Context, companyID } func (p PanelStore) GetEmployeeByID(c *gofr.Context, companyID, employeeID int) (models.Employee, error) { - const query = "select * from employee where company_id=? and id=?" + const query = "select * from employees where company_id=? and id=?" var inputInterface []interface{} inputInterface = append(inputInterface, companyID, employeeID) rows, err := c.DB.Query(query, inputInterface...) @@ -81,7 +81,7 @@ func (p PanelStore) GetEmployeeByID(c *gofr.Context, companyID, employeeID int) } func (p PanelStore) CreateEmployee(c *gofr.Context, companyID int, emp *models.Employee) (int, error) { - const query = `insert into employee(name, email, phone, designation, yoe, company_id) values(?,?,?,?,?,?)` + const query = `insert into employees(name, email, phone, designation, yoe, company_id) values(?,?,?,?,?,?)` var inputInterface []interface{} inputInterface = append(inputInterface, emp.Name, emp.Email, emp.Phone, emp.Designation, emp.YOE, companyID) rows, err := c.DB.Exec(query, inputInterface...) @@ -97,7 +97,7 @@ func (p PanelStore) CreateEmployee(c *gofr.Context, companyID int, emp *models.E func (p PanelStore) EditEmployee(c *gofr.Context, companyID, employeeID int, emp *models.Employee) (int, error) { var inputInterface []interface{} - const query = "update employee set designation = ?, yoe = ?, phone = ? where company_id = ? and id = ?" + const query = "update employees set designation = ?, yoe = ?, phone = ? where company_id = ? and id = ?" inputInterface = append(inputInterface, emp.Designation, emp.YOE, emp.Phone, companyID, employeeID) row, err := c.DB.Exec(query, inputInterface...) if err != nil { @@ -113,7 +113,7 @@ func (p PanelStore) EditEmployee(c *gofr.Context, companyID, employeeID int, emp func (p PanelStore) DeleteEmployee(c *gofr.Context, companyID, employeeID int) error { var inputInterface []interface{} inputInterface = append(inputInterface, employeeID, companyID) - rows, err := c.DB.Exec("DELETE FROM employee WHERE id=? AND company_id=?", inputInterface...) + rows, err := c.DB.Exec("DELETE FROM employees WHERE id=? AND company_id=?", inputInterface...) if err != nil { // Happens in connection loose or if the query is wrong. return customerror.ErrDBServer diff --git a/panel/store/store_test.go b/panel/store/store_test.go index ec00ff64..fc51dd44 100644 --- a/panel/store/store_test.go +++ b/panel/store/store_test.go @@ -103,7 +103,7 @@ func TestGetAllEmployeeWithDesignationMock(t *testing.T) { if i == 3 { table := []string{"id", "name", "email", "phone", "designation", "yoe"} - query := "select * from employee where companyid=? and designation=? and yoe>=? order by id desc limit ?,?" + query := "select * from employees where companyid=? and designation=? and yoe>=? order by id desc limit ?,?" rows := sqlmock.NewRows(table) for j := range testCases[i].expectedOutput { rows.AddRow(testCases[i].expectedOutput[j].ID, testCases[i].expectedOutput[j].Name, @@ -116,7 +116,7 @@ func TestGetAllEmployeeWithDesignationMock(t *testing.T) { output, err = dataStore.GetAllEmployeeWithDesignation(c, testCases[i].input, testCases[i].queryParams) } else if i == 1 { table := []string{"id", "name", "email", "phone", "designation", "company_id"} - query := "select * from employee where company_id=? and designation=? and yoe>=? order by id desc limit ?,?" + query := "select * from employees where company_id=? and designation=? and yoe>=? order by id desc limit ?,?" rows := sqlmock.NewRows(table) rows.AddRow(2, "Bittu Ray", "bitturay@gmail.com", 7250073080, "sde2", 2) @@ -125,7 +125,7 @@ func TestGetAllEmployeeWithDesignationMock(t *testing.T) { output, err = dataStore.GetAllEmployeeWithDesignation(c, testCases[i].input, testCases[i].queryParams) } else { table := []string{"id", "name", "email", "phone", "designation", "yoe", "company_id"} - query := "select * from employee where company_id=? and designation=? and yoe>=? order by id desc limit ?,?" + query := "select * from employees where company_id=? and designation=? and yoe>=? order by id desc limit ?,?" rows := sqlmock.NewRows(table) for j := range testCases[i].expectedOutput { rows.AddRow(testCases[i].expectedOutput[j].ID, testCases[i].expectedOutput[j].Name, @@ -223,7 +223,7 @@ func TestGetAllEmployeeWithoutDesignationMock(t *testing.T) { if i == 3 { table := []string{"id", "name", "email", "phone", "designation", "yoe"} - query := "select * from employee where companyid=? and yoe>=? order by id desc limit ?,?" + query := "select * from employees where companyid=? and yoe>=? order by id desc limit ?,?" rows := sqlmock.NewRows(table) for j := range testCases[i].expectedOutput { rows.AddRow(testCases[i].expectedOutput[j].ID, testCases[i].expectedOutput[j].Name, @@ -236,7 +236,7 @@ func TestGetAllEmployeeWithoutDesignationMock(t *testing.T) { output, err = dataStore.GetAllEmployeeWithoutDesignation(c, testCases[i].input, testCases[i].queryParams) } else if i == 1 { table := []string{"id", "name", "email", "phone", "designation", "company_id"} - query := "select * from employee where company_id=? and yoe>=? order by id desc limit ?,?" + query := "select * from employees where company_id=? and yoe>=? order by id desc limit ?,?" rows := sqlmock.NewRows(table) rows.AddRow(2, "Bittu Ray", "bitturay@gmail.com", 7250073080, "sde2", 2) @@ -245,7 +245,7 @@ func TestGetAllEmployeeWithoutDesignationMock(t *testing.T) { output, err = dataStore.GetAllEmployeeWithoutDesignation(c, testCases[i].input, testCases[i].queryParams) } else { table := []string{"id", "name", "email", "phone", "designation", "yoe", "company_id"} - query := "select * from employee where company_id=? and yoe>=? order by id desc limit ?,?" + query := "select * from employees where company_id=? and yoe>=? order by id desc limit ?,?" rows := sqlmock.NewRows(table) for j := range testCases[i].expectedOutput { rows.AddRow(testCases[i].expectedOutput[j].ID, testCases[i].expectedOutput[j].Name, @@ -314,7 +314,7 @@ func TestGetEmployeeByIDMock(t *testing.T) { var output, err interface{} if i == 1 { table := []string{"id", "name", "email", "phone", "designation", "company_id"} - query := "select * from employee where company_id=? and id=?" + query := "select * from employees where company_id=? and id=?" rows := sqlmock.NewRows(table) rows.AddRow(1, "Bittu Ray", "bitturay@gmail.com", 7250073080, "sde2", 1) mock.ExpectQuery(regexp.QuoteMeta(query)).WithArgs(testCases[i].input.companyID, testCases[i].input.empID). @@ -322,7 +322,7 @@ func TestGetEmployeeByIDMock(t *testing.T) { output, err = dataStore.GetEmployeeByID(c, testCases[i].input.companyID, testCases[i].input.empID) } else if i == 3 { table := []string{"id", "name", "email", "phone", "designation", "yoe", "company_id"} - query := "select * from employee where companyd=? and id=?" + query := "select * from employees where companyd=? and id=?" rows := sqlmock.NewRows(table). AddRow(testCases[i].expectedOutput.ID, testCases[i].expectedOutput.Name, testCases[i].expectedOutput.Email, testCases[i].expectedOutput.Phone, @@ -335,7 +335,7 @@ func TestGetEmployeeByIDMock(t *testing.T) { output, err = dataStore.GetEmployeeByID(c, testCases[i].input.companyID, testCases[i].input.empID) } else { table := []string{"id", "name", "email", "phone", "designation", "yoe", "company_id"} - query := "select * from employee where company_id=? and id=?" + query := "select * from employees where company_id=? and id=?" rows := sqlmock.NewRows(table). AddRow(testCases[i].expectedOutput.ID, testCases[i].expectedOutput.Name, testCases[i].expectedOutput.Email, testCases[i].expectedOutput.Phone, @@ -407,14 +407,14 @@ func TestCreateEmployeeMock(t *testing.T) { for i := range testCases { var output, err interface{} if i == 3 { - query := "insert into employee(name, email, phone, designation, yoe, company_id) values(?,?,?,?,?)" + query := "insert into employees(name, email, phone, designation, yoe, company_id) values(?,?,?,?,?)" mock.ExpectExec(regexp.QuoteMeta(query)). WithArgs(testCases[i].input.body.Name, testCases[i].input.body.Email, testCases[i].input.body.Phone, testCases[i].input.body.Designation, testCases[i].input.body.YOE). WillReturnResult(sqlmock.NewResult(int64(testCases[i].expectedOutput), int64(testCases[i].rowsAffected))) output, err = dataStore.CreateEmployee(c, testCases[i].input.companyID, &testCases[i].input.body) } else { - query := "insert into employee(name, email, phone, designation, yoe, company_id) values(?,?,?,?,?,?)" + query := "insert into employees(name, email, phone, designation, yoe, company_id) values(?,?,?,?,?,?)" mock.ExpectExec(regexp.QuoteMeta(query)). WithArgs(testCases[i].input.body.Name, testCases[i].input.body.Email, testCases[i].input.body.Phone, testCases[i].input.body.Designation, @@ -484,7 +484,7 @@ func TestEditEmployeeMock(t *testing.T) { for i := range testCases { var output, err interface{} if i == 3 { - query := "update employee set designtion = ?, yoe = ?, phone = ? where company_id = ? and id = ?" + query := "update employees set designtion = ?, yoe = ?, phone = ? where company_id = ? and id = ?" mock.ExpectExec(regexp.QuoteMeta(query)). WithArgs(testCases[i].input.body.Designation, testCases[i].input.body.YOE, testCases[i].input.body.Phone, @@ -493,7 +493,7 @@ func TestEditEmployeeMock(t *testing.T) { output, err = dataStore.EditEmployee(c, testCases[i].input.companyID, testCases[i].input.empID, &testCases[i].input.body) } else { - query := "update employee set designation = ?, yoe = ?, phone = ? where company_id = ? and id = ?" + query := "update employees set designation = ?, yoe = ?, phone = ? where company_id = ? and id = ?" mock.ExpectExec(regexp.QuoteMeta(query)). WithArgs(testCases[i].input.body.Designation, testCases[i].input.body.YOE, testCases[i].input.body.Phone, @@ -555,7 +555,7 @@ func TestDeleteEmployeeMock(t *testing.T) { for i, val := range testCases { if i == 2 { - mock.ExpectExec(regexp.QuoteMeta("DELETE FROM employee WHERE id=? AND companyd=?")). + mock.ExpectExec(regexp.QuoteMeta("DELETE FROM employees WHERE id=? AND companyd=?")). WithArgs(val.input.id, val.input.companyId). WillReturnResult(sqlmock.NewResult(0, val.rowsAffected)) actualError := dataStore.DeleteEmployee(c, val.input.id, val.input.companyId) @@ -564,7 +564,7 @@ func TestDeleteEmployeeMock(t *testing.T) { t.Errorf("FAILED!! Expected value: %v Actual Output: %v\n", val.expectedErr, actualError) } } else { - mock.ExpectExec(regexp.QuoteMeta("DELETE FROM employee WHERE id=? AND company_id=?")). + mock.ExpectExec(regexp.QuoteMeta("DELETE FROM employees WHERE id=? AND company_id=?")). WithArgs(val.input.id, val.input.companyId). WillReturnResult(sqlmock.NewResult(0, val.rowsAffected)) actualError := dataStore.DeleteEmployee(c, val.input.companyId, val.input.id) From 72998f5bb039678992d8e0e133a6299a7ac77962 Mon Sep 17 00:00:00 2001 From: raybittu Date: Mon, 15 Feb 2021 15:37:49 +0530 Subject: [PATCH 06/10] #3 | in case of error, nil returned instead of any string at http layer --- panel/.DS_Store | Bin 6148 -> 0 bytes panel/http/http.go | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 panel/.DS_Store diff --git a/panel/.DS_Store b/panel/.DS_Store deleted file mode 100644 index 597f1e1a83ca1eccb3d56da0bb0f9282284aea15..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK!EVz)5S>k()(IeTsMH>PLE;dhSP*)skSr4py&)OF0Z?n#R%6NaMz)gxX^=1c z1MmlY3SYp7@BuJ0yP(7=CnSWT9clK>?!H-P-^ROM01*B(b^&?-V51XST`aCK>L=f@ zmTu`F3Lc|?5H28rdr)n#O@mRuDDb~2K=1BNI0p$cd~a9Z-#1X5Wb!=9WP}{rAdb=R z{$RrhpamoF8=NoKaiV!S(c^rLCRtimgTXh^+OgWZd$!%RySKWpgRz_kRai|+KP+BS z?P*wzBOO1JGW#8e(epH!pZ4}2%e)HHJSjLijT5B2dXeU_ocnT`$0d&ws1Doi*qzhf z;bJj#-M%w)hs(aRI64~iod@?HE|(qq;Ewy~GQYq&aoa3ofr1w6(uf1>U6s#*F>aF;Od7lo4c;zX;%G6Bn?c#&es6I1pycPz zAjL&Z*4ey(A6FKzjqHkk=?0UQag~WxW80>H{%hMewryf&K1Knfz+Wps`-6i{=xMAK z^45U`UjYy;Y-YolJ{2g((dcQc6=DyXP^pM2Rp={*Q0dt2Xr8CBR;bcJ=*x%DPZs)y zBKYYzzQc47o Date: Mon, 15 Feb 2021 15:53:16 +0530 Subject: [PATCH 07/10] updated db schema according to swagger --- db/schema.sql | 217 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 184 insertions(+), 33 deletions(-) diff --git a/db/schema.sql b/db/schema.sql index ac2327f1..965cd729 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -1,6 +1,6 @@ -- MySQL dump 10.13 Distrib 8.0.22, for macos10.15 (x86_64) -- --- Host: localhost Database: hiringPortal +-- Host: localhost Database: hiring_portal -- ------------------------------------------------------ -- Server version 8.0.23 @@ -15,6 +15,11 @@ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- Creating Database hiring_portal +CREATE DATABASE hiring_portal; +USE hiring_portal; +-- -- -- Table structure for table `companies` -- @@ -23,12 +28,12 @@ DROP TABLE IF EXISTS `companies`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `companies` ( - `id` int NOT NULL AUTO_INCREMENT, - `name` varchar(45) NOT NULL, - `description` varchar(45) DEFAULT NULL, - `domain` varchar(45) NOT NULL, - `email` varchar(45) NOT NULL, - PRIMARY KEY (`id`) + `id` int NOT NULL AUTO_INCREMENT, + `name` varchar(45) NOT NULL, + `description` varchar(45) DEFAULT NULL, + `domain` varchar(45) NOT NULL, + `email` varchar(45) NOT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -49,16 +54,16 @@ DROP TABLE IF EXISTS `employees`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `employees` ( - `id` int NOT NULL AUTO_INCREMENT, - `name` varchar(45) NOT NULL, - `email` varchar(45) NOT NULL, - `phone` bigint DEFAULT NULL, - `designation` varchar(45) NOT NULL, - `yoe` int NOT NULL DEFAULT '0', - `company_id` int DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `comapny_id_idx` (`company_id`), - CONSTRAINT `company_id` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) + `id` int NOT NULL AUTO_INCREMENT, + `name` varchar(45) NOT NULL, + `email` varchar(45) NOT NULL, + `phone` bigint DEFAULT NULL, + `designation` varchar(45) NOT NULL, + `yoe` int NOT NULL DEFAULT '0', + `company_id` int DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `comapny_id_idx` (`company_id`), + CONSTRAINT `company_id` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -79,9 +84,9 @@ DROP TABLE IF EXISTS `skills`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `skills` ( - `id` int NOT NULL AUTO_INCREMENT, - `name` varchar(45) NOT NULL, - PRIMARY KEY (`id`) + `id` int NOT NULL AUTO_INCREMENT, + `name` varchar(45) NOT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -95,29 +100,75 @@ LOCK TABLES `skills` WRITE; UNLOCK TABLES; -- --- Table structure for table `skillsEmployees` +-- Table structure for table `employee_skills` -- -DROP TABLE IF EXISTS `skillsEmployees`; +DROP TABLE IF EXISTS `employee_skills`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `skillsEmployees` ( - `employee_id` int NOT NULL, - `skill_id` int NOT NULL, - PRIMARY KEY (`employee_id`,`skill_id`), - KEY `skill_id_idx` (`skill_id`), - CONSTRAINT `employee_id` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`), - CONSTRAINT `emp_skill_id` FOREIGN KEY (`skill_id`) REFERENCES `skills` (`id`) + `employee_id` int NOT NULL, + `skill_id` int NOT NULL, + PRIMARY KEY (`employee_id`,`skill_id`), + KEY `skill_id_idx` (`skill_id`), + CONSTRAINT `employee_id` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`), + CONSTRAINT `emp_skill_id` FOREIGN KEY (`skill_id`) REFERENCES `skills` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `employee_skills` +-- + +LOCK TABLES `employee_skills` WRITE; +/*!40000 ALTER TABLE `employee_skills` DISABLE KEYS */; +/*!40000 ALTER TABLE `employee_skills` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- +-- Table structure for table `positions` +-- + +DROP TABLE IF EXISTS `positions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `positions` ( + `id` int NOT NULL AUTO_INCREMENT, + `noOfOpenings` int NOT NULL, + `description` varchar(45) NOT NULL, + `location` varchar(45) NOT NULL, + `currentNoOfOpenings` int NOT NULL, + `startDate` datetime NOT NULL, + `endDate` datetime NOT NULL, + `status` tinyint NOT NULL, + `title` varchar(45) NOT NULL, + `postDate` datetime NOT NULL, + `experience` float NOT NULL, + `companyId` int NOT NULL, + `pid` varchar(45) NOT NULL, + `is_deleted` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `id_idx` (`companyId`), + CONSTRAINT `id` FOREIGN KEY (`companyId`) REFERENCES `companies` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `skillsEmployees` +-- Dumping data for table `positions` -- -LOCK TABLES `skillsEmployees` WRITE; -/*!40000 ALTER TABLE `skillsEmployees` DISABLE KEYS */; -/*!40000 ALTER TABLE `skillsEmployees` ENABLE KEYS */; +LOCK TABLES `positions` WRITE; +/*!40000 ALTER TABLE `positions` DISABLE KEYS */; +/*!40000 ALTER TABLE `positions` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -129,4 +180,104 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-02-12 16:03:51 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!50503 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!50503 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `candidates` +-- + +DROP TABLE IF EXISTS `candidates`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `candidates` ( + `id` int NOT NULL AUTO_INCREMENT, + `name` varchar(45) NOT NULL, + `email` varchar(45) NOT NULL, + `phone` bigint NOT NULL, + `college_name` varchar(45) DEFAULT NULL, + `experience` float DEFAULT NULL, + `resume` varchar(60) NOT NULL, + `skills` int DEFAULT NULL, + `gender` varchar(10) NOT NULL, + `bio` varchar(45) DEFAULT NULL, + `dob` datetime NOT NULL, + `github` varchar(60) DEFAULT 'no Link', + `linkedin` varchar(60) DEFAULT 'no Link', + `others` varchar(100) DEFAULT 'no Links', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!50503 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `candidates_skills` +-- + +DROP TABLE IF EXISTS `candidates_skills`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `candidates_skills` ( + `candidate_id` int NOT NULL, + `skill_id` int NOT NULL, + PRIMARY KEY (`candidate_id`,`skill_id`), + KEY `skill_id_idx` (`skill_id`), + CONSTRAINT `candidate_id` FOREIGN KEY (`candidate_id`) REFERENCES `candidates` (`id`), + CONSTRAINT `candidate_skill_id` FOREIGN KEY (`skill_id`) REFERENCES `skills` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2021-02-15 11:38:30 + From f392acaae61bba2aac003209ea4580f91278719a Mon Sep 17 00:00:00 2001 From: raybittu Date: Mon, 15 Feb 2021 16:05:34 +0530 Subject: [PATCH 08/10] made service and store layer's structs unexported --- main.go | 8 ++++---- panel/service/service.go | 14 +++++++------- panel/store/store.go | 16 ++++++++-------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/main.go b/main.go index f9d9548c..81fff930 100644 --- a/main.go +++ b/main.go @@ -15,10 +15,10 @@ func main() { dataHttp := http.New(dataService) app.GET("/{companyID}/employees", dataHttp.GetAllEmployee) - app.GET("/{companyID}/employee/{employeeID}", dataHttp.GetEmployeeByID) - app.POST("/{companyID}/employee", dataHttp.CreateEmployee) - app.PUT("/{companyID}/employee/{employeeID}", dataHttp.EditEmployee) - app.DELETE("/{companyID}/employee/{employeeID}", dataHttp.DeleteEmployee) + app.GET("/{companyID}/employees/{employeeID}", dataHttp.GetEmployeeByID) + app.POST("/{companyID}/employees", dataHttp.CreateEmployee) + app.PUT("/{companyID}/employees/{employeeID}", dataHttp.EditEmployee) + app.DELETE("/{companyID}/employees/{employeeID}", dataHttp.DeleteEmployee) app.Run() } diff --git a/panel/service/service.go b/panel/service/service.go index e0bd4f02..c58fc560 100644 --- a/panel/service/service.go +++ b/panel/service/service.go @@ -7,15 +7,15 @@ import ( "github.com/zopsmart/hiring-portal-api/panel/store" ) -type PanelEmployeeService struct { +type panelEmployeeService struct { store store.Panel } func New(store store.Panel) PanelEmployee { - return PanelEmployeeService{store: store} + return panelEmployeeService{store: store} } -func (p PanelEmployeeService) GetAllEmployee(c *gofr.Context, companyID int, queryParam map[string]interface{}) ([]models.Employee, error) { +func (p panelEmployeeService) GetAllEmployee(c *gofr.Context, companyID int, queryParam map[string]interface{}) ([]models.Employee, error) { if companyID <= 0 { return nil, customError.ErrInvalidCompanyID } @@ -25,7 +25,7 @@ func (p PanelEmployeeService) GetAllEmployee(c *gofr.Context, companyID int, que return p.store.GetAllEmployeeWithDesignation(c, companyID, queryParam) } -func (p PanelEmployeeService) GetEmployeeByID(c *gofr.Context, companyID, employeeID int) (models.Employee, error) { +func (p panelEmployeeService) GetEmployeeByID(c *gofr.Context, companyID, employeeID int) (models.Employee, error) { if companyID <= 0 { return models.Employee{}, customError.ErrInvalidCompanyID } @@ -35,7 +35,7 @@ func (p PanelEmployeeService) GetEmployeeByID(c *gofr.Context, companyID, employ return p.store.GetEmployeeByID(c, companyID, employeeID) } -func (p PanelEmployeeService) CreateEmployee(c *gofr.Context, companyID int, emp *models.Employee) (models.Employee, error) { +func (p panelEmployeeService) CreateEmployee(c *gofr.Context, companyID int, emp *models.Employee) (models.Employee, error) { if companyID <= 0 { return models.Employee{}, customError.ErrInvalidCompanyID } @@ -48,7 +48,7 @@ func (p PanelEmployeeService) CreateEmployee(c *gofr.Context, companyID int, emp return *emp, nil } -func (p PanelEmployeeService) EditEmployee(c *gofr.Context, companyID, employeeID int, emp *models.Employee) (models.Employee, error) { +func (p panelEmployeeService) EditEmployee(c *gofr.Context, companyID, employeeID int, emp *models.Employee) (models.Employee, error) { if companyID <= 0 { return models.Employee{}, customError.ErrInvalidCompanyID } @@ -64,7 +64,7 @@ func (p PanelEmployeeService) EditEmployee(c *gofr.Context, companyID, employeeI return *emp, nil } -func (p PanelEmployeeService) DeleteEmployee(c *gofr.Context, companyID, employeeID int) error { +func (p panelEmployeeService) DeleteEmployee(c *gofr.Context, companyID, employeeID int) error { if companyID <= 0 { return customError.ErrInvalidCompanyID } diff --git a/panel/store/store.go b/panel/store/store.go index 38f609dd..64f5e184 100644 --- a/panel/store/store.go +++ b/panel/store/store.go @@ -6,13 +6,13 @@ import ( "github.com/zopsmart/hiring-portal-api/panel/models" ) -type PanelStore struct{} +type panelStore struct{} func New() Panel { - return PanelStore{} + return panelStore{} } -func (p PanelStore) GetAllEmployeeWithDesignation(c *gofr.Context, companyID int, queryParams map[string]interface{}) ([]models.Employee, error) { +func (p panelStore) GetAllEmployeeWithDesignation(c *gofr.Context, companyID int, queryParams map[string]interface{}) ([]models.Employee, error) { const query = "select * from employees where company_id=? and designation=? and yoe>=? order by id desc limit ?,?" var inputInterface []interface{} inputInterface = append(inputInterface, companyID, queryParams["designation"], queryParams["yoe"], queryParams["page"], queryParams["limit"]) @@ -35,7 +35,7 @@ func (p PanelStore) GetAllEmployeeWithDesignation(c *gofr.Context, companyID int return res, nil } -func (p PanelStore) GetAllEmployeeWithoutDesignation(c *gofr.Context, companyID int, queryParams map[string]interface{}) ([]models.Employee, error) { +func (p panelStore) GetAllEmployeeWithoutDesignation(c *gofr.Context, companyID int, queryParams map[string]interface{}) ([]models.Employee, error) { const query = "select * from employees where company_id=? and yoe>=? order by id desc limit ?,?" var inputInterface []interface{} inputInterface = append(inputInterface, companyID, queryParams["yoe"], queryParams["page"], queryParams["limit"]) @@ -58,7 +58,7 @@ func (p PanelStore) GetAllEmployeeWithoutDesignation(c *gofr.Context, companyID return res, nil } -func (p PanelStore) GetEmployeeByID(c *gofr.Context, companyID, employeeID int) (models.Employee, error) { +func (p panelStore) GetEmployeeByID(c *gofr.Context, companyID, employeeID int) (models.Employee, error) { const query = "select * from employees where company_id=? and id=?" var inputInterface []interface{} inputInterface = append(inputInterface, companyID, employeeID) @@ -80,7 +80,7 @@ func (p PanelStore) GetEmployeeByID(c *gofr.Context, companyID, employeeID int) return res, nil } -func (p PanelStore) CreateEmployee(c *gofr.Context, companyID int, emp *models.Employee) (int, error) { +func (p panelStore) CreateEmployee(c *gofr.Context, companyID int, emp *models.Employee) (int, error) { const query = `insert into employees(name, email, phone, designation, yoe, company_id) values(?,?,?,?,?,?)` var inputInterface []interface{} inputInterface = append(inputInterface, emp.Name, emp.Email, emp.Phone, emp.Designation, emp.YOE, companyID) @@ -95,7 +95,7 @@ func (p PanelStore) CreateEmployee(c *gofr.Context, companyID int, emp *models.E return int(id), nil } -func (p PanelStore) EditEmployee(c *gofr.Context, companyID, employeeID int, emp *models.Employee) (int, error) { +func (p panelStore) EditEmployee(c *gofr.Context, companyID, employeeID int, emp *models.Employee) (int, error) { var inputInterface []interface{} const query = "update employees set designation = ?, yoe = ?, phone = ? where company_id = ? and id = ?" inputInterface = append(inputInterface, emp.Designation, emp.YOE, emp.Phone, companyID, employeeID) @@ -110,7 +110,7 @@ func (p PanelStore) EditEmployee(c *gofr.Context, companyID, employeeID int, emp return int(id), nil } -func (p PanelStore) DeleteEmployee(c *gofr.Context, companyID, employeeID int) error { +func (p panelStore) DeleteEmployee(c *gofr.Context, companyID, employeeID int) error { var inputInterface []interface{} inputInterface = append(inputInterface, employeeID, companyID) rows, err := c.DB.Exec("DELETE FROM employees WHERE id=? AND company_id=?", inputInterface...) From 911ef49f50ab9039fa3c44ea39f1776e37fdc835 Mon Sep 17 00:00:00 2001 From: raybittu Date: Mon, 15 Feb 2021 16:15:40 +0530 Subject: [PATCH 09/10] #3 chnaged rowaffected to r instead of id --- panel/store/store.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/panel/store/store.go b/panel/store/store.go index 64f5e184..a42840fb 100644 --- a/panel/store/store.go +++ b/panel/store/store.go @@ -103,11 +103,11 @@ func (p panelStore) EditEmployee(c *gofr.Context, companyID, employeeID int, emp if err != nil { return -1, customerror.ErrDBServer } - id, _ := row.RowsAffected() - if id == 0 { + r, _ := row.RowsAffected() + if r == 0 { return -1, customerror.ErrRecordNotFound } - return int(id), nil + return int(r), nil } func (p panelStore) DeleteEmployee(c *gofr.Context, companyID, employeeID int) error { From 0ae07474e299e47e3056776b42078b0cf5d80fca Mon Sep 17 00:00:00 2001 From: raybittu Date: Mon, 15 Feb 2021 16:21:54 +0530 Subject: [PATCH 10/10] changed import names of error and removed panel.zip --- panel.zip | Bin 15644 -> 0 bytes panel/http/http.go | 20 ++-- swagger/EmployeePanel.yaml | 211 ------------------------------------- 3 files changed, 10 insertions(+), 221 deletions(-) delete mode 100644 panel.zip delete mode 100644 swagger/EmployeePanel.yaml diff --git a/panel.zip b/panel.zip deleted file mode 100644 index 86a1d48a247d6c52f232d9aa883a022cae6503a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15644 zcmbt*1z40z`#wl_N_T^R(v5U2-QC@dw19+!(%s#SgmgC&(w)*MC7|$UJqJaPe&2U~ z|KZwwmwm5&YVLXFnVI{Q1%QF0g8*BUzoh)P4}ZTwf)Ih&>RB6EK2}mh0D&SfpwK0} zeF3jd&)`5n!B0U!K)(G}_L~f75a^#|fMbDxAbpoXFQlNO;AmrS^xuT-$F)gk@nQ9} z@SEppvDrTvUDK32dl!#d>o#pEP)^X8;8;a4ALfe;@RbA`S1w^``i!`P`=O5Ld;1mL9BTyn?=!+W?v1yn&b@x;;#gG>2rPby0n-=(ZZ~4u_NHM<~lfUB_zNC zXmF!SBVX7}avXVJUsPZU5fIKc61w(XPasNIR6FYyhl7 z%HPRC_%6%J#?Z*p;eQnME5MscK|oNyi!!irHnP_T=J*}sz`^pH0aFqWu%CMZ zA8^j&kM#WAs)D}tS}slxlihkm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?08b6!)u&`_wLA@o?9& zeVTt&@h@0xziPQp#QHgCHMix=?}PU3+q*^5zsTD6`BFaz%?kAwUH?$=hf|1O-MLSX z`Wa}9Xm={UQ=Avxfhlj=x`j{;VbO c$BxBvhE diff --git a/panel/http/http.go b/panel/http/http.go index 93fd753e..c6c35282 100644 --- a/panel/http/http.go +++ b/panel/http/http.go @@ -6,7 +6,7 @@ import ( "github.com/zopsmart/hiring-portal-api/panel/models" "github.com/vikash/gofr/pkg/gofr" - customError "github.com/zopsmart/hiring-portal-api/panel/error" + customerror "github.com/zopsmart/hiring-portal-api/panel/error" "github.com/zopsmart/hiring-portal-api/panel/service" ) @@ -21,14 +21,14 @@ func New(service service.PanelEmployee) PanelHTTP { func (p PanelHTTP) CreateEmployee(c *gofr.Context) (interface{}, error) { companyID, err := strconv.Atoi(c.Request.PathParam("companyID")) if err != nil { - return nil, customError.ErrInvalidCompanyID + return nil, customerror.ErrInvalidCompanyID } var emp models.Employee err = c.Request.Bind(&emp) if err != nil { - return nil, customError.ErrJSONFormat + return nil, customerror.ErrJSONFormat } res, err := p.service.CreateEmployee(c, companyID, &emp) @@ -43,7 +43,7 @@ func (p PanelHTTP) CreateEmployee(c *gofr.Context) (interface{}, error) { func (p PanelHTTP) GetAllEmployee(c *gofr.Context) (interface{}, error) { companyID, err := strconv.Atoi(c.Request.PathParam("companyID")) if err != nil { - return nil, customError.ErrInvalidCompanyID + return nil, customerror.ErrInvalidCompanyID } yoe, _ := strconv.Atoi(c.Param("yoe")) @@ -77,11 +77,11 @@ func (p PanelHTTP) GetAllEmployee(c *gofr.Context) (interface{}, error) { func (p PanelHTTP) GetEmployeeByID(c *gofr.Context) (interface{}, error) { companyId, err := strconv.Atoi(c.Request.PathParam("companyID")) if err != nil { - return nil, customError.ErrInvalidCompanyID + return nil, customerror.ErrInvalidCompanyID } employeeId, err := strconv.Atoi(c.Request.PathParam("employeeID")) if err != nil { - return nil, customError.ErrInvalidEmployeeID + return nil, customerror.ErrInvalidEmployeeID } res, err := p.service.GetEmployeeByID(c, companyId, employeeId) @@ -95,11 +95,11 @@ func (p PanelHTTP) GetEmployeeByID(c *gofr.Context) (interface{}, error) { func (p PanelHTTP) EditEmployee(c *gofr.Context) (interface{}, error) { companyID, err := strconv.Atoi(c.Request.PathParam("companyID")) if err != nil { - return nil, customError.ErrInvalidCompanyID + return nil, customerror.ErrInvalidCompanyID } employeeID, err := strconv.Atoi(c.Request.PathParam("employeeID")) if err != nil { - return nil, customError.ErrInvalidEmployeeID + return nil, customerror.ErrInvalidEmployeeID } var data models.Employee @@ -116,11 +116,11 @@ func (p PanelHTTP) EditEmployee(c *gofr.Context) (interface{}, error) { func (p PanelHTTP) DeleteEmployee(c *gofr.Context) (interface{}, error) { companyID, err := strconv.Atoi(c.Request.PathParam("companyID")) if err != nil { - return nil, customError.ErrInvalidCompanyID + return nil, customerror.ErrInvalidCompanyID } employeeID, err := strconv.Atoi(c.Request.PathParam("employeeID")) if err != nil { - return nil, customError.ErrInvalidEmployeeID + return nil, customerror.ErrInvalidEmployeeID } return nil, p.service.DeleteEmployee(c, companyID, employeeID) diff --git a/swagger/EmployeePanel.yaml b/swagger/EmployeePanel.yaml deleted file mode 100644 index 7d09a695..00000000 --- a/swagger/EmployeePanel.yaml +++ /dev/null @@ -1,211 +0,0 @@ -swagger: "2.0" -info: - description: "This is a sample `quizzing-HR` api specifications doc. These docs will be used during the interview and panel selection process." - version: "0.0.0" - title: "Hiring Portal API - #3EmployeePanel" - termsOfService: "http://zopsmart.com/terms/" - contact: - email: "ishan.pandey@zopsmart.com" - license: - name: "Apache 2.0" - url: "http://www.apache.org/licenses/LICENSE-2.0.html" -host: "quiz-hr.swagger.io" -basePath: "/v0" -tags: -- name: "panel-employee" - description: "Every operation about an employee belonging to a company" -schemes: -- "https" -- "http" - -paths: -#----------------------------------------------------------------------------------------------- - /employee/{companyID}: - get: - tags: - - "panel-employee" - summary: "Lists everything about an employee" - description: "..." - operationId: "allEmployeeInACompany" - produces: - - "application/json" - parameters: - - name: companyID - in: path - description: ID of company whose all employees need to be fetched. - required: true - type: integer - format: int64 - responses: - "200": - description: "sucessful operation" - schema: - type: "array" - items: - $ref: "#/definitions/Employee" - "500": - description: "Internal server error" - post: - tags: - - "panel-employee" - summary: "Creates a new employee in a company, and returns it's id." - operationId: "createNewEmployeeInACompany" - consumes: - - "application/json" - produces: - - "application/json" - parameters: - - name: companyID - in: path - description: ID of company inside which employee is to be created. - required: true - type: integer - format: int64 - - in: "body" - name: "data" - description: "Input employee data" - required: true - # Isme confirm for the schema, whether id will be input. - schema: - $ref: "#/definitions/Employee" - responses: - "200": - description: "sucessful operation" - # Confirm return schema. - schema: - $ref: "#/definitions/Employee" - "500": - description: "Internal server error" - - /employee/{companyID}/{employeeID}: - get: - tags: - - "panel-employee" - summary: "Lists everything about an employee" - description: "..." - operationId: "employeeInACompany" - produces: - - "application/json" - parameters: - - name: companyID - in: path - description: ID of company whose all employees need to be fetched. - required: true - type: integer - format: int64 - - name: employeeID - in: path - description: ID of employee whose details need to be fetched. - required: true - type: integer - format: int64 - responses: - "200": - description: "sucessful operation" - schema: - $ref: "#/definitions/Employee" - "500": - description: "Internal server error" - put: - tags: - - "panel-employee" - summary: "Edit details of an employee belonging to a company" - description: "" - operationId: "editEmployeeInACompany" - consumes: - - "application/json" - produces: - - "application/json" - parameters: - - name: companyID - in: path - description: ID of company whose employee details need to be edited. - required: true - type: integer - format: int64 - - name: employeeID - in: path - description: ID of employee whose details need to be edited/updated. - required: true - type: integer - format: int64 - - in: "body" - name: "body" - description: "Pet object that needs to be added to the store" - required: true - schema: - $ref: "#/definitions/Employee" - responses: - "200": - description: "sucessful operation" - schema: - $ref: "#/definitions/Employee" - "500": - description: "Internal server error" - - delete: - tags: - - "panel-employee" - summary: "Deletes an employee of a company" - description: "..." - operationId: "deleteEmployeeInACompany" - produces: - - "application/json" - parameters: - - name: companyID - in: path - description: ID of company whose employee needs to be deleted. - required: true - type: integer - format: int64 - - name: employeeID - in: path - description: ID of employee which is deleted. - required: true - type: integer - format: int64 - responses: - "200": - description: "sucessful operation" - "500": - description: "Internal server error" - -#----------------------------------------------------------------------------------------------- -definitions: - Employee: - type: "object" - properties: - id: - type: "integer" - format: "int64" - example: 1 - name: - type: "string" - example: "Itachi Uchiha" - email: - type: "string" - example: "xyz@zopsmart.com" - phone: - type: "integer" - format: "int64" - example: 9454323321 - designation: - type: "string" - example: "SDE-1" - # skills: - # type: "array" - # items: - # type: "string" - # example: "JAVA" - YOE: - type: "integer" - format: "int32" - example: 2 - companyID: - type: "integer" - format: "int64" - example: 1 - -externalDocs: - description: "Find out more about Quizzer-HR" - url: "https://docs.google.com/document/d/10Em-YRUfzJunVT37WyjJCYFuzpQ_cbI-ToScVQNcGiM/edit?ts=601b8c8a" \ No newline at end of file