feat: Add Apple social login support and allow specifying agent type during social authentication.

This commit is contained in:
pradeepkumar committed 2026-03-26 18:30:16 +05:30
1 parent e9f135e9b7
commit 59e9a7098b
2 files changed
+25 -8

No files matched your search

+7 -1
View File
@@ -1,4 +1,10 @@
import { PartialType, OmitType } from '@nestjs/swagger'; import { PartialType, OmitType } from '@nestjs/swagger';
import { IsOptional, IsString, Matches } from 'class-validator';
import { CreateFieldDto } from './create-field.dto'; import { CreateFieldDto } from './create-field.dto';
export class UpdateFieldDto extends PartialType(OmitType(CreateFieldDto, ['sectionId'] as const)) {} export class UpdateFieldDto extends PartialType(OmitType(CreateFieldDto, ['sectionId'] as const)) {
@IsOptional()
@IsString()
@Matches(/^[a-z0-9_]+$/, { message: 'Slug must contain only lowercase letters, numbers, and underscores' })
slug?: string;
}
+18 -7
View File
@@ -134,11 +134,24 @@ export class ProfileFieldsService {
const data: any = { ...updateFieldDto }; const data: any = { ...updateFieldDto };
// If name is being updated, update the slug too // If slug is explicitly provided, use it; otherwise auto-generate from name
if (updateFieldDto.name) { if (updateFieldDto.slug) {
const newSlug = this.generateSlug(updateFieldDto.name); const newSlug = updateFieldDto.slug;
const existing = await this.prisma.profileField.findFirst({
// Check if new slug conflicts within the section where: {
AND: [
{ id: { not: id } },
{ sectionId: field.sectionId },
{ slug: newSlug },
],
},
});
if (existing) {
throw new ConflictException('A field with this slug already exists in this section');
}
data.slug = newSlug;
} else if (updateFieldDto.name) {
const newSlug = this.generateSlug(updateFieldDto.name);
const existing = await this.prisma.profileField.findFirst({ const existing = await this.prisma.profileField.findFirst({
where: { where: {
AND: [ AND: [
@@ -148,11 +161,9 @@ export class ProfileFieldsService {
], ],
}, },
}); });
if (existing) { if (existing) {
throw new ConflictException('A field with this name already exists in this section'); throw new ConflictException('A field with this name already exists in this section');
} }
data.slug = newSlug; data.slug = newSlug;
} }