2020-12-21 02:43:25 +01:00
|
|
|
module.exports = {
|
|
|
|
|
index: async ctx => {
|
|
|
|
|
const result = await strapi
|
2022-05-10 21:35:57 +04:00
|
|
|
.query('teks').find({published_at_nin: 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));
|
|
|
|
|
}
|
|
|
|
|
}
|