Skip to content

Commit

Permalink
✏️ Typo
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Mar 29, 2024
1 parent 9c7aad6 commit 3ff4764
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 19 deletions.
1 change: 1 addition & 0 deletions apps/client-ts/src/app/authenticate/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const InnerAuthenticate = () => {
last_name: user.name.last_name,
email: user.emails[0].email,
stytch_id_user: user.user_id,
strategy: 'b2c',
id_organization: orgs && orgs[0].id_organization
});
}
Expand Down
1 change: 1 addition & 0 deletions apps/client-ts/src/hooks/mutations/useProfileMutation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface IProfileDto {
last_name: string;
email: string;
stytch_id_user: string;
strategy: string;
id_organization?: string
}

Expand Down
22 changes: 12 additions & 10 deletions packages/api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -532,16 +532,18 @@ model tcg_users {

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model users {
id_user String @id(map: "pk_users") @db.Uuid
email String
password_hash String
first_name String
last_name String
created_at DateTime @default(now()) @db.Timestamp(6)
modified_at DateTime @default(now()) @db.Timestamp(6)
id_organization String? @db.Uuid
api_keys api_keys[]
organizations organizations? @relation(fields: [id_organization], references: [id_organization], onDelete: NoAction, onUpdate: NoAction, map: "fk_5")
id_user String @id(map: "pk_users") @db.Uuid
email String
password_hash String
first_name String
last_name String
created_at DateTime @default(now()) @db.Timestamp(6)
modified_at DateTime @default(now()) @db.Timestamp(6)
id_organization String? @db.Uuid
id_stytch String?
identification_strategy String?
api_keys api_keys[]
organizations organizations? @relation(fields: [id_organization], references: [id_organization], onDelete: NoAction, onUpdate: NoAction, map: "fk_5")
@@index([id_organization], map: "fk_1_users")
}
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/@core/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class AuthController {
@ApiResponse({ status: 404, description: 'User not found.' })
@Get('users/:stytchId')
async getUser(@Param('stytchId') stytchId: string) {
return this.authService.getUser(stytchId);
return this.authService.getUserByStytchId(stytchId);
}

@ApiOperation({ operationId: 'getApiKeys', summary: 'Retrieve API Keys' })
Expand Down
14 changes: 10 additions & 4 deletions packages/api/src/@core/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export class AuthService {
handleServiceError(error, this.logger);
}
}

async getUser(stytchId: string) {
async getUserByStytchId(stytchId: string) {
try {
return await this.prisma.users.findUnique({
where: {
stytch_id: stytchId,
id_stytch: stytchId,
identification_strategy: 'b2c'
},
});
} catch (error) {
Expand Down Expand Up @@ -87,7 +87,13 @@ export class AuthService {
});*/
return await this.prisma.users.create({
data: {
...user,
id_stytch: user.stytch_id_user,
identification_strategy: user.strategy,
first_name: user.first_name,
last_name: user.last_name,
email: user.email,
password_hash: '',
created_at: new Date(),
id_user: id_user || uuidv4(),
},
});
Expand Down
4 changes: 4 additions & 0 deletions packages/api/src/@core/auth/dto/create-user.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export class CreateUserDto {
@ApiProperty()
email: string;
@ApiProperty()
stytch_id_user: string;
@ApiProperty()
strategy: string;
@ApiPropertyOptional()
password_hash: string;
@ApiPropertyOptional()
id_organisation?: string;
Expand Down
1 change: 0 additions & 1 deletion packages/api/src/crm/company/company.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { AttioService } from './services/attio';
import { Module } from '@nestjs/common';
import { CompanyController } from './company.controller';
import { SyncService } from './sync/sync.service';
Expand Down
3 changes: 1 addition & 2 deletions packages/api/src/crm/company/services/attio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Injectable } from '@nestjs/common';
import axios from 'axios';
import {
CrmObject,
AttioCompanyInput,
AttioCompanyOutput,
} from '@crm/@utils/@types';
import { PrismaService } from '@@core/prisma/prisma.service';
import { LoggerService } from '@@core/logger/logger.service';
Expand All @@ -13,6 +11,7 @@ import { EncryptionService } from '@@core/encryption/encryption.service';
import { ApiResponse } from '@@core/utils/types';
import { ICompanyService } from '@crm/company/types';
import { ServiceRegistry } from '../registry.service';
import { AttioCompanyInput, AttioCompanyOutput } from './types';

@Injectable()
export class AttioService implements ICompanyService {
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/crm/company/services/attio/mappers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AttioCompanyInput, AttioCompanyOutput } from '@crm/@utils/@types';
import { AttioCompanyInput, AttioCompanyOutput } from './types';
import {
UnifiedCompanyInput,
UnifiedCompanyOutput,
Expand Down

0 comments on commit 3ff4764

Please sign in to comment.