2020-12-21 02:43:25 +01:00
|
|
|
module.exports = {
|
|
|
|
|
index: async ctx => {
|
|
|
|
|
const result = await strapi
|
|
|
|
|
.query('teks')
|
2020-12-23 23:17:58 +01:00
|
|
|
.model.find({published_at: {$ne: null}})
|
2020-12-21 02:43:25 +01:00
|
|
|
const sortedResult = result.sort((a, b) => {
|
|
|
|
|
const aDate = new Date(a.published_at)
|
|
|
|
|
const bDate = new Date(b.published_at)
|
|
|
|
|
return bDate.getTime() - aDate.getTime()
|
|
|
|
|
})
|
|
|
|
|
ctx.send(sortedResult.map(({slug}) => slug));
|
|
|
|
|
}
|
|
|
|
|
}
|