Added getPictures and getPicturesByUserId func
parent
4026a40fa1
commit
6924c9ddbf
|
@ -73,11 +73,21 @@ func Save(c *fiber.Ctx) error {
|
||||||
func GetPictures(c *fiber.Ctx) error {
|
func GetPictures(c *fiber.Ctx) error {
|
||||||
db := database.DB
|
db := database.DB
|
||||||
|
|
||||||
log.Info("here")
|
pictures := []map[string]interface{}{}
|
||||||
|
|
||||||
pictures := &[]structs.Picture{}
|
db.Model(structs.Picture{}).Select("user_id", "picture_id", "likes", "description").Find(&pictures)
|
||||||
|
|
||||||
db.Find(pictures)
|
return c.JSON(pictures)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetPicturesByUserId(c *fiber.Ctx) error {
|
||||||
|
db := database.DB
|
||||||
|
|
||||||
|
log.Infoln("")
|
||||||
|
|
||||||
|
pictures := []structs.APIPicture{}
|
||||||
|
|
||||||
|
db.Model(structs.Picture{}).Where("user_id", c.Params("id")).Find(&pictures)
|
||||||
|
|
||||||
return c.JSON(pictures)
|
return c.JSON(pictures)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue