* feat: Add routing-forms record response endpoint with available slots * fix: resolve TypeScript error in handleResponse.test.ts - Fix type mismatch where mockResponse was passed as identifierKeyedResponse - identifierKeyedResponse expects Record<string, string | string[]> structure - Updated test to pass correct data structure for type compatibility Co-Authored-By: [email protected] <[email protected]> * fix: correct POST endpoint parameter handling and request body parsing in routing forms responses controller - Change @Query() to @Body() decorator for POST request data in controller - Update service method to accept parsed body data directly - Remove incorrect URLSearchParams parsing of request.body object - Fix getRoutingUrl method to use form response data parameter This resolves API v2 test failures by following proper NestJS patterns for POST request handling. Co-Authored-By: [email protected] <[email protected]> * Pass teamMemberEmail as well * Devin fixes reverted * Keep all routing related props together in both endpoints * Remove newly added slots props from Slots documentation as they are used through internal fn call only * fix test * Pass skipContactOwner * Pass crmAppSlug and crmOwnerRecordGType and add more tests * handle external redirect case and form not found case * hide props * chore: bump platform libs --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]> Co-authored-by: cal.com <[email protected]> Co-authored-by: Morgan <[email protected]>
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { PrismaReadService } from "@/modules/prisma/prisma-read.service";
|
|
import { PrismaWriteService } from "@/modules/prisma/prisma-write.service";
|
|
import { TestingModule } from "@nestjs/testing";
|
|
import { randomBytes, createHash } from "crypto";
|
|
|
|
export class ApiKeysRepositoryFixture {
|
|
private prismaReadClient: PrismaReadService["prisma"];
|
|
private prismaWriteClient: PrismaWriteService["prisma"];
|
|
|
|
constructor(private readonly module: TestingModule) {
|
|
this.prismaReadClient = module.get(PrismaReadService).prisma;
|
|
this.prismaWriteClient = module.get(PrismaWriteService).prisma;
|
|
}
|
|
|
|
async createApiKey(userId: number, expiresAt: Date | null, teamId?: number) {
|
|
const keyString = randomBytes(16).toString("hex");
|
|
const hashedKey = createHash("sha256").update(keyString).digest("hex");
|
|
console.log("createApiKey Fixutre", { hashedKey, keyString });
|
|
const apiKey = await this.prismaWriteClient.apiKey.create({
|
|
data: {
|
|
userId,
|
|
teamId,
|
|
hashedKey,
|
|
expiresAt: expiresAt,
|
|
},
|
|
});
|
|
|
|
return { apiKey, keyString };
|
|
}
|
|
|
|
async getTeamApiKeys(teamId: number) {
|
|
return await this.prismaReadClient.apiKey.findMany({
|
|
where: {
|
|
teamId,
|
|
},
|
|
});
|
|
}
|
|
}
|