func BuildQuery(c *gin.Context) interface{} { values := c.Request.URL.Query() query := map[string]interface{}{} utils.ProcessAndAddIfExist("company_id", &values, query, utils.ConvertToObjectId) utils.ProcessAndAddIfExist("owner", &values, query, utils.ConvertToObjectId) return query }
func BuildQuery(c *gin.Context) interface{} { values := c.Request.URL.Query() query := map[string]interface{}{} utils.ProcessAndAddIfExist("interview", &values, query, utils.ConvertToObjectId) utils.ProcessAndAddIfExist("candidate", &values, query, utils.ConvertToObjectId) utils.ProcessAndAddIfExist("vacancy", &values, query, utils.ConvertToObjectId) return query }
func BuildQuery(c *gin.Context) interface{} { values := c.Request.URL.Query() query := map[string]interface{}{} utils.ProcessAndAddIfExist("owner", &values, query, utils.ConvertToObjectId) log.Debugf("Values %v", query) return &query }
func BuildQuery(c *gin.Context) (error, interface{}) { values := c.Request.URL.Query() query := map[string]interface{}{} for _, prop := range idsProps { err := utils.ProcessAndAddIfExist(prop, &values, query, utils.ConvertToObjectId) if err != nil { return err, query } } relatedTo := values.Get("relatedTo") if strutils.IsNotEmpty(relatedTo) { if !bson.IsObjectIdHex(relatedTo) { return errors.New("relatedTo is not valid ObjectIdHex"), query } query["$or"] = buildRelatedToQuery(relatedTo) } return nil, query }