Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Added types to database/teams

dominicbachmann68f9bca0540b
diff --git a/src/lib/database/teams.ts b/src/lib/database/teams.ts
index dd9a14cfff..45d8fb5db6 100644
--- a/src/lib/database/teams.ts
+++ b/src/lib/database/teams.ts
@@ -1,9 +1,10 @@
+import type { Team, Permission } from '@prisma/client';
import { prisma } from './common';
-export async function listTeams() {
+export async function listTeams(): Promise<Team[]> {
return await prisma.team.findMany();
}
-export async function newTeam({ name, userId }) {
+export async function newTeam({ name, userId }: { name: string; userId: string }): Promise<Team> {
return await prisma.team.create({
data: {
name,
@@ -12,7 +13,11 @@ export async function newTeam({ name, userId }) {
}
});
}
-export async function getMyTeams({ userId }) {
+export async function getMyTeams({
+ userId
+}: {
+ userId: string;
+}): Promise<(Permission & { team: Team & { _count: { users: number } } })[]> {
return await prisma.permission.findMany({
where: { userId },
include: { team: { include: { _count: { select: { users: true } } } } }