liquid_feedback_frontend

changeset 1751:ddbd46a34b6a

Allow API lookup of member profile fields
author bsw
date Tue Oct 12 15:37:28 2021 +0200 (2021-10-12)
parents d15767492064
children 6d69bc46440e
files app/main/api/member.lua
line diff
     1.1 --- a/app/main/api/member.lua	Mon Oct 11 11:03:04 2021 +0200
     1.2 +++ b/app/main/api/member.lua	Tue Oct 12 15:37:28 2021 +0200
     1.3 @@ -54,6 +54,23 @@
     1.4    selector:add_where{ "name ILIKE ? OR identification ILIKE ?", search, search }
     1.5  end
     1.6  
     1.7 +if app.scopes.read_profiles then
     1.8 +  local profile_lookups = false
     1.9 +  for i, field in ipairs(config.member_profile_fields) do
    1.10 +    if field.api_lookup then
    1.11 +      local value = param.get("profile_" .. field.id)
    1.12 +      if value then
    1.13 +        selector:add_where{ "member_profile.profile->>? = ?", field.id, value }
    1.14 +        profile_lookups = true
    1.15 +      end
    1.16 +    end
    1.17 +  end
    1.18 +  if profile_lookups then
    1.19 +    selector:join("member_profile", nil, "member_profile.member_id = member.id")
    1.20 +  end
    1.21 +end
    1.22 +
    1.23 +
    1.24  local members = selector:exec()
    1.25  local r = json.object()
    1.26  r.result = execute.chunk{ module = "api", chunk = "_member", params = { 

Impressum / About Us