mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-30 19:29:17 +01:00
12 lines
324 B
TypeScript
12 lines
324 B
TypeScript
|
|
import { max } from "drizzle-orm";
|
||
|
|
|
||
|
|
import type { HomarrDatabase } from "../driver";
|
||
|
|
import { groups } from "../schema";
|
||
|
|
|
||
|
|
export const getMaxGroupPositionAsync = async (db: HomarrDatabase) => {
|
||
|
|
return await db
|
||
|
|
.select({ value: max(groups.position) })
|
||
|
|
.from(groups)
|
||
|
|
.then((result) => result[0]?.value ?? 1);
|
||
|
|
};
|