You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

32 lines
786 B

// _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)