17 lines
429 B
TypeScript
17 lines
429 B
TypeScript
import "server-only";
|
|
import { db } from "./db";
|
|
|
|
/**
|
|
* Returns the single seeded operator row. Since the app has no auth,
|
|
* every action is attributed to this operator.
|
|
*/
|
|
export async function getSeededOperator() {
|
|
const op = await db.query.operators.findFirst({
|
|
orderBy: (o, { asc }) => [asc(o.createdAt)],
|
|
});
|
|
if (!op) {
|
|
throw new Error("No operator row seeded. Run scripts/db.sh seed.");
|
|
}
|
|
return op;
|
|
}
|