feat: v2 teams CRUD (#18019)

* feat: teams endpoints

* refactor: organization teams reuse team types

* refactor: move team specific functions out of organizations-teams.repository

* supporting files

* regenerate docs

* feat: stripe service to generate team creation checkout

* refactor: request payment when creating a team

* fix: tests

* fix env

* driveby: event type name and email booking fields

* finish merge main
This commit is contained in:
Lauris Skraucis
2024-12-17 14:19:57 +00:00
committed by GitHub
parent b0094bad2d
commit a0f986f949
38 changed files with 2081 additions and 446 deletions
@@ -3,7 +3,7 @@ import { PrismaWriteService } from "@/modules/prisma/prisma-write.service";
import { CreateManagedUserInput } from "@/modules/users/inputs/create-managed-user.input";
import { UpdateManagedUserInput } from "@/modules/users/inputs/update-managed-user.input";
import { Injectable, NotFoundException } from "@nestjs/common";
import type { Profile, User, Team } from "@prisma/client";
import type { Profile, User, Team, Prisma } from "@prisma/client";
export type UserWithProfile = User & {
movedToProfile?: (Profile & { organization: Pick<Team, "isPlatform" | "id" | "slug" | "name"> }) | null;
@@ -184,6 +184,13 @@ export class UsersRepository {
});
}
async updateByEmail(email: string, updateData: Prisma.UserUpdateInput) {
return this.dbWrite.prisma.user.update({
where: { email },
data: updateData,
});
}
async updateUsername(userId: number, newUsername: string) {
return this.dbWrite.prisma.user.update({
where: { id: userId },