diff --git a/api-doc.md b/api-doc.md index 2074f370f..949f47910 100644 --- a/api-doc.md +++ b/api-doc.md @@ -417,3 +417,71 @@ - Headers : none - Message : Acceptence mail has been sent successfully ``` + +### 9. Get Career Page LifeatCanopas Section Images + +``` +- Method : GET +- Endpoint : /api/lifeimages +- Description : API for get images of lifeat canopas section of career page +- Request: + - Headers : none + - Body : none + +- Response : + + - If API is not found or image data not found then, + - Status Code: 404 not found + - Data: no response data + + - If any server error is there then, + - Status Code: 500 Internal server error + - Data: no response data + + - If request will success , + - Status Code: 200 Ok + - Headers : none + - Data : + [ + { + "id": 1, + "image_urls": "https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-400.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-800.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-1600.webp", + "index": 0 + }, + ] + +``` + +### 10. Get Career Page Perks and Benefit Section Images + +``` +- Method : GET +- Endpoint : /api/perksimages +- Description : API for get images of perks and benefit section of career page +- Request: + - Headers : none + - Body : none + +- Response : + + - If API is not found or image data not found then, + - Status Code: 404 not found + - Data: no response data + + - If any server error is there then, + - Status Code: 500 Internal server error + - Data: no response data + + - If request will success , + - Status Code: 200 Ok + - Headers : none + - Data : + [ + { + "id": 1, + "image_urls": "https://canopas-website.s3.ap-south-1.amazonaws.com/perksBenefits/1-400.webp,https://canopas-website.s3.ap-south-1.amazonaws.com//perksBenefits/1-800.webp", + "index": 0 + }, + ] + +``` diff --git a/jobs/life_perks_images.go b/jobs/life_perks_images.go index 2ac9dea3e..c88c8fc4c 100644 --- a/jobs/life_perks_images.go +++ b/jobs/life_perks_images.go @@ -11,7 +11,7 @@ import ( type LifePerksImages struct { Id int `json:"id"` - ImageUrls string `json:"imageUrls"` + ImageUrls string `json:"image_urls"` Index int `json:"index"` } @@ -25,7 +25,7 @@ func NewLifePerksImages(db *sqlx.DB) *LifeandPerksRepository { func (repository *LifeandPerksRepository) LifeImages(c *gin.Context) { lifeImages := []LifePerksImages{} - err := repository.Db.Select(&lifeImages, "SELECT l.id, l.imageUrls, l.index FROM lifeatcanopas l") + err := repository.Db.Select(&lifeImages, "SELECT l.id, l.image_urls, l.index FROM lifeatcanopas l") if err != nil { log.Error(err) c.AbortWithStatus(http.StatusInternalServerError) @@ -36,7 +36,7 @@ func (repository *LifeandPerksRepository) LifeImages(c *gin.Context) { func (repository *LifeandPerksRepository) PerksImages(c *gin.Context) { perksImages := []LifePerksImages{} - err := repository.Db.Select(&perksImages, "SELECT p.id, p.imageUrls, p.index FROM perks p") + err := repository.Db.Select(&perksImages, "SELECT p.id, p.image_urls, p.index FROM perks p") if err != nil { log.Error(err) c.AbortWithStatus(http.StatusInternalServerError) diff --git a/jobs/life_perks_images_test.go b/jobs/life_perks_images_test.go index f564668ad..6748d7794 100644 --- a/jobs/life_perks_images_test.go +++ b/jobs/life_perks_images_test.go @@ -70,14 +70,14 @@ func TestGetAllPerksImages(t *testing.T) { func expectedLifeImages() map[string]interface{} { lifeImages := make(map[string]interface{}) lifeImages["id"] = 1.0 - lifeImages["imageUrls"] = "https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-400.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-800.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-1600.webp" + lifeImages["image_urls"] = "https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-400.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-800.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-1600.webp" lifeImages["index"] = 0.0 return lifeImages } func expectedPerkImages() map[string]interface{} { perkImages := make(map[string]interface{}) perkImages["id"] = 1.0 - perkImages["imageUrls"] = "https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-400.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-800.webp" + perkImages["image_urls"] = "https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-400.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-800.webp" perkImages["index"] = 0.0 return perkImages } diff --git a/utils/test.go b/utils/test.go index 66b09455b..46bb14d6c 100644 --- a/utils/test.go +++ b/utils/test.go @@ -109,7 +109,7 @@ func CreateTables(db *sqlx.DB) error { _, err = db.Exec(jobsIcons) - lifeatCanopas := "CREATE TABLE lifeatcanopas (id SERIAL PRIMARY KEY, imageUrls varchar, index int4 NOT NULL DEFAULT 0, created_at timestamptz DEFAULT CURRENT_TIMESTAMP,updated_at timestamptz DEFAULT CURRENT_TIMESTAMP)" + lifeatCanopas := "CREATE TABLE lifeatcanopas (id SERIAL PRIMARY KEY, image_urls varchar, index int4 NOT NULL DEFAULT 0, created_at timestamptz DEFAULT CURRENT_TIMESTAMP,updated_at timestamptz DEFAULT CURRENT_TIMESTAMP)" _, err = db.Exec(lifeatCanopas) @@ -117,7 +117,7 @@ func CreateTables(db *sqlx.DB) error { return err } - perkImages := "CREATE TABLE perks (id SERIAL PRIMARY KEY, imageUrls varchar, index int4 NOT NULL DEFAULT 0, created_at timestamptz DEFAULT CURRENT_TIMESTAMP,updated_at timestamptz DEFAULT CURRENT_TIMESTAMP)" + perkImages := "CREATE TABLE perks (id SERIAL PRIMARY KEY, image_urls varchar, index int4 NOT NULL DEFAULT 0, created_at timestamptz DEFAULT CURRENT_TIMESTAMP,updated_at timestamptz DEFAULT CURRENT_TIMESTAMP)" _, err = db.Exec(perkImages) @@ -142,8 +142,8 @@ func PrepareTablesData(db *sqlx.DB) { db.MustExec("INSERT INTO job_applications(id, name, email, phone, place,reference, resumeURL, position, message, status, created_at, updated_at) VALUES(1, 'New Web Developer', 'developer@gmail.com', '1234567890', 'surat', 'From canopas', '', 'Web Developer from testing', 'I m a very good programer', '1',current_timestamp, current_timestamp)") db.MustExec("INSERT INTO job_applicant_statuses(id, applicant_id, status, index, rejection_with_mail, created_at, updated_at) VALUES(1, 1, 1, 0, false, current_timestamp,current_timestamp )") db.MustExec("INSERT INTO job_icons (id,name,value,createdAt,updatedAt) VALUES ('1','iOS','fab fa-apple',NULL,NULL);") - db.MustExec("INSERT INTO lifeatcanopas (id,imageUrls,created_at,updated_at) VALUES(1,'https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-400.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-800.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-1600.webp',current_timestamp, current_timestamp)") - db.MustExec("INSERT INTO perks (id,imageUrls,created_at,updated_at) VALUES(1,'https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-400.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-800.webp',current_timestamp, current_timestamp)") + db.MustExec("INSERT INTO lifeatcanopas (id,image_urls,created_at,updated_at) VALUES(1,'https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-400.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-800.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-1600.webp',current_timestamp, current_timestamp)") + db.MustExec("INSERT INTO perks (id,image_urls,created_at,updated_at) VALUES(1,'https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-400.webp,https://canopas-website.s3.ap-south-1.amazonaws.com/lifeCanopas/1-800.webp',current_timestamp, current_timestamp)") } func PrepareTextFileFormData() (string, *bytes.Buffer) {