// _core : social/userPessoa
|
|
|
|
const dbComunidades = _db.query(`
|
|
SELECT
|
|
uid,
|
|
nome,
|
|
descricao,
|
|
imagem,
|
|
(
|
|
SELECT count(id)
|
|
FROM pessoa_comunidade
|
|
WHERE pessoa_id = ?
|
|
AND comunidade_id = comunidade.id
|
|
) seguindo
|
|
FROM comunidade
|
|
WHERE active = true
|
|
ORDER BY nome
|
|
`, userPessoa().getInt("id"))
|
|
|
|
const data = _val.list()
|
|
|
|
for (const dbComunidade of dbComunidades) {
|
|
data.add(
|
|
_val.map()
|
|
.set("uid", dbComunidade.getString("uid"))
|
|
.set("name", dbComunidade.getString("nome"))
|
|
.set("description", dbComunidade.getString("descricao"))
|
|
.set("following", dbComunidade.getInt("seguindo"))
|
|
)
|
|
}
|
|
|
|
_out.json(dbComunidades)
|