import define from "../../../define.js";
import { Plans } from "@/models/index.js";

export const meta = {
	tags: ["admin"],

	requireCredential: true,
	requireAdmin: true,
} as const;

export const paramDef = {
	type: "object",
	properties: {},
	required: [],
} as const;

export default define(meta, paramDef, async () => {
	const plans = await Plans.find({
		order: {
			createdAt: "ASC",
		},
	});

	return await Plans.packMany(plans);
});
