Estágio Escola Superior de Tecnologia de Setúbal. https://www.estsetubal.ips.pt/
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.
 

31 lines
833 B

// _core : social/userPessoa
const dbComunidades = _db.query(`
SELECT
comunidade.uid,
comunidade.nome,
comunidade.descricao,
(
SELECT count(comunidade_id)
FROM pessoa_comunidade
WHERE pessoa_id = ?
AND comunidade_id = comunidade.id
) AS seguindo
FROM comunidade
WHERE comunidade.active = true
ORDER BY comunidade.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") > 0)
)
}
_out.json(data)