mirror of
https://github.com/hex248/sprint.git
synced 2026-02-09 02:33:02 +00:00
more Free/Pro plan limitations
This commit is contained in:
@@ -14,4 +14,5 @@ export const FREE_TIER_LIMITS = {
|
||||
projectsPerOrganisation: 1,
|
||||
issuesPerOrganisation: 100,
|
||||
membersPerOrganisation: 5,
|
||||
sprintsPerProject: 5,
|
||||
} as const;
|
||||
|
||||
@@ -152,3 +152,13 @@ export async function getUserOrganisationCount(userId: number): Promise<number>
|
||||
.where(eq(OrganisationMember.userId, userId));
|
||||
return result?.count ?? 0;
|
||||
}
|
||||
|
||||
export async function getOrganisationOwner(organisationId: number) {
|
||||
const [owner] = await db
|
||||
.select({ userId: OrganisationMember.userId })
|
||||
.from(OrganisationMember)
|
||||
.where(
|
||||
and(eq(OrganisationMember.organisationId, organisationId), eq(OrganisationMember.role, "owner")),
|
||||
);
|
||||
return owner;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Issue, Sprint } from "@sprint/shared";
|
||||
import { and, desc, eq, gte, lte, ne } from "drizzle-orm";
|
||||
import { and, desc, eq, gte, lte, ne, sql } from "drizzle-orm";
|
||||
import { db } from "../client";
|
||||
|
||||
export async function createSprint(
|
||||
@@ -72,3 +72,11 @@ export async function deleteSprint(sprintId: number) {
|
||||
await db.update(Issue).set({ sprintId: null }).where(eq(Issue.sprintId, sprintId));
|
||||
await db.delete(Sprint).where(eq(Sprint.id, sprintId));
|
||||
}
|
||||
|
||||
export async function getProjectSprintCount(projectId: number) {
|
||||
const result = await db
|
||||
.select({ count: sql<number>`count(*)::int` })
|
||||
.from(Sprint)
|
||||
.where(eq(Sprint.projectId, projectId));
|
||||
return result[0]?.count ?? 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user