Getters now return the no_preview status

This commit is contained in:
Nicolai Ort 2021-09-25 17:21:30 +02:00
parent 33d7c94648
commit e5b8557e4c
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
1 changed files with 3 additions and 2 deletions

View File

@ -220,7 +220,7 @@ fastify.get('/api/:shortcode', async (req, res) => {
return 404;
}
const exists = await knex.select('shortcode', 'target')
const exists = await knex.select('shortcode', 'target', 'no_preview')
.from('urls')
.where('shortcode', '=', shortcode)
.limit(1);
@ -236,6 +236,7 @@ fastify.get('/api/:shortcode', async (req, res) => {
url: `${config.getBaseUrl()}/${exists[0].shortcode}`,
shortcode: exists[0].shortcode,
target: exists[0].target,
no_preview: exists[0].no_preview,
visits: visits.length
}
});
@ -322,7 +323,7 @@ fastify.after(() => {
//Get all urls api route
fastify.get('/api', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, res) => {
urls = await knex.select('target', 'shortcode')
urls = await knex.select('target', 'shortcode', 'no_preview')
.from('urls');
for (let url of urls) {