fix: set DESC order
This commit is contained in:
parent
9662b587e3
commit
6bf4109465
@ -58,6 +58,7 @@ router.put(
|
|||||||
|
|
||||||
const pinned_count = await Message.count({
|
const pinned_count = await Message.count({
|
||||||
where: { channel: { id: channel_id }, pinned_at: Not(IsNull()) },
|
where: { channel: { id: channel_id }, pinned_at: Not(IsNull()) },
|
||||||
|
order: { pinned_at: "DESC" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const { maxPins } = Config.get().limits.channel;
|
const { maxPins } = Config.get().limits.channel;
|
||||||
@ -184,6 +185,7 @@ router.get(
|
|||||||
const pins = await Message.find({
|
const pins = await Message.find({
|
||||||
where: { channel_id: channel_id, pinned_at: Not(IsNull()) },
|
where: { channel_id: channel_id, pinned_at: Not(IsNull()) },
|
||||||
relations: ["author"],
|
relations: ["author"],
|
||||||
|
order: { pinned_at: "DESC" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const items = pins.map((message: Message) => ({
|
const items = pins.map((message: Message) => ({
|
||||||
|
|||||||
@ -59,6 +59,7 @@ router.put(
|
|||||||
|
|
||||||
const pinned_count = await Message.count({
|
const pinned_count = await Message.count({
|
||||||
where: { channel: { id: channel_id }, pinned_at: Not(IsNull()) },
|
where: { channel: { id: channel_id }, pinned_at: Not(IsNull()) },
|
||||||
|
order: { pinned_at: "DESC" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const { maxPins } = Config.get().limits.channel;
|
const { maxPins } = Config.get().limits.channel;
|
||||||
@ -185,6 +186,7 @@ router.get(
|
|||||||
const pins = await Message.find({
|
const pins = await Message.find({
|
||||||
where: { channel_id: channel_id, pinned_at: Not(IsNull()) },
|
where: { channel_id: channel_id, pinned_at: Not(IsNull()) },
|
||||||
relations: ["author"],
|
relations: ["author"],
|
||||||
|
order: { pinned_at: "DESC" },
|
||||||
});
|
});
|
||||||
|
|
||||||
res.send(pins);
|
res.send(pins);
|
||||||
|
|||||||
Reference in New Issue
Block a user