Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updates tree #103

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions packages/api/src/@core/auth/auth.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import {
Controller,
Request,
Post,
Body,
Get,
UseGuards,
} from '@nestjs/common';
import { CreateUserDto, LoginCredentials } from './dto/create-user.dto';
import { AuthService } from './auth.service';
import { JwtAuthGuard } from './guards/jwt-auth.guard';
import { LoggerService } from '@@core/logger/logger.service';

@Controller('auth')
export class AuthController {
constructor(
private readonly authService: AuthService,
private logger: LoggerService,
) {}

@Post('register')
async registerUser(@Body() user: CreateUserDto) {
return this.authService.register(user);
}

@Post('login')
async login(@Body() user: LoginCredentials) {
return this.authService.login(user);
}

@Get('users')
async users() {
return this.authService.getUsers();
}

@Get('api-keys')
async apiKeys() {
return this.authService.getApiKeys();
}

@UseGuards(JwtAuthGuard)
@Post('generate-apikey')
async generateApiKey(
@Request() req,
@Body() data: { projectId: number },
): Promise<{ api_key: string }> {
const userId = req.user.userId;
this.logger.log('user id is ' + userId);
return await this.authService.generateApiKeyForUser(userId, data.projectId);
}
}
2 changes: 2 additions & 0 deletions packages/api/src/@core/auth/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import { ApiKeyStrategy } from './strategies/auth-header-api-key.strategy';
import { PrismaService } from '../prisma/prisma.service';
import { ConfigService } from '@nestjs/config';
import { LoggerService } from '@@core/logger/logger.service';
import { AuthController } from './auth.controller';

@Module({
controllers: [AuthController],
providers: [
AuthService,
JwtStrategy,
Expand Down
41 changes: 0 additions & 41 deletions packages/api/src/@core/utils/unification/crm/freshsales/index.ts

This file was deleted.

61 changes: 0 additions & 61 deletions packages/api/src/@core/utils/unification/crm/hubspot/index.ts

This file was deleted.

74 changes: 0 additions & 74 deletions packages/api/src/@core/utils/unification/crm/index.ts

This file was deleted.

41 changes: 0 additions & 41 deletions packages/api/src/@core/utils/unification/crm/pipedrive/index.ts

This file was deleted.

41 changes: 0 additions & 41 deletions packages/api/src/@core/utils/unification/crm/zendesk/index.ts

This file was deleted.

45 changes: 0 additions & 45 deletions packages/api/src/@core/utils/unification/crm/zoho/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/api/src/@core/utils/unification/desunify.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CrmObject } from '@crm/@types';
import { ProviderVertical, getProviderVertical } from '../providers';
import { desunifyCrm } from './crm';
import { DesunifyReturnType, TargetObject, Unified } from '../types';
import { desunifyCrm } from '@crm/@unification';

/* to insert data

Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/@core/utils/unification/unify.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CrmObject } from '@crm/@types';
import { ProviderVertical, getProviderVertical } from '../providers';
import { TargetObject, UnifyReturnType, UnifySourceType } from '../types';
import { unifyCrm } from './crm';
import { unifyCrm } from '@crm/@unification';

/* to fetch data

Expand Down
Loading