creating the api endpoint that fetches the content of the news instead of text metdata

This commit is contained in:
SimonGschnell
2024-06-24 16:05:51 +02:00
parent 7267d526bb
commit 27287bd07a
4 changed files with 68 additions and 12 deletions
+11 -2
View File
@@ -19,14 +19,23 @@ class News_model extends DB_Model
*/
public function getAll($limit = null)
{
$this->addJoin("campus.tbl_content","content_id");
return $this->loadWhere('
text IS NOT NULL
AND datum <= NOW() AND (datum_bis IS NULL OR datum_bis >= now()::date)
text IS NOT NULL
datum <= NOW() AND (datum_bis IS NULL OR datum_bis >= now()::date)
ORDER BY datum DESC
LIMIT ' . $this->escape($limit)
);
}
public function getNewsContentIDs($limit=10){
$this->addSelect(['content_id']);
return $this->loadWhere("datum <= NOW() AND (datum_bis IS NULL OR datum_bis >= now()::date)
ORDER BY datum DESC
LIMIT " . $this->escape($limit));
}
/**