mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-06 05:07:36 -05:00
20 lines
476 B
TypeScript
20 lines
476 B
TypeScript
import * as PlusSuggestionRepository from "~/features/plus-suggestions/PlusSuggestionRepository.server";
|
|
import {
|
|
nextNonCompletedVoting,
|
|
rangeToMonthYear,
|
|
} from "~/features/plus-voting/core";
|
|
|
|
export const loader = async () => {
|
|
const nextVotingRange = nextNonCompletedVoting(new Date());
|
|
|
|
if (!nextVotingRange) {
|
|
return { suggestions: [] };
|
|
}
|
|
|
|
return {
|
|
suggestions: await PlusSuggestionRepository.findAllByMonth(
|
|
rangeToMonthYear(nextVotingRange),
|
|
),
|
|
};
|
|
};
|