Skip to content

Commit

Permalink
Merge pull request #93 from panoratech/feat/addings
Browse files Browse the repository at this point in the history
feat: done
  • Loading branch information
naelob authored Nov 25, 2023
2 parents 3f8e148 + 23f417c commit 0dcfeb7
Show file tree
Hide file tree
Showing 31 changed files with 481 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export class CreateLinkedUserDto {
linked_user_origin_id: string;
alias: string;
status?: string;
id_project: number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { LinkedUsersController } from './linked-users.controller';

describe('LinkedUsersController', () => {
let controller: LinkedUsersController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [LinkedUsersController],
}).compile();

controller = module.get<LinkedUsersController>(LinkedUsersController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
});
});
19 changes: 19 additions & 0 deletions packages/api/src/@core/linked-users/linked-users.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Body, Controller, Post } from '@nestjs/common';
import { LinkedUsersService } from './linked-users.service';
import { LoggerService } from '../logger/logger.service';
import { CreateLinkedUserDto } from './dto/create-linked-user.dto';

@Controller('linked-users')
export class LinkedUsersController {
constructor(
private readonly linkedUsersService: LinkedUsersService,
private logger: LoggerService,
) {
this.logger.setContext(LinkedUsersController.name);
}

@Post('create')
addLinkedUser(@Body() linkedUserCreateDto: CreateLinkedUserDto) {
return this.linkedUsersService.addLinkedUser(linkedUserCreateDto);
}
}
11 changes: 11 additions & 0 deletions packages/api/src/@core/linked-users/linked-users.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common';
import { LinkedUsersService } from './linked-users.service';
import { LinkedUsersController } from './linked-users.controller';
import { LoggerService } from '../logger/logger.service';
import { PrismaService } from '../prisma/prisma.service';

@Module({
providers: [LinkedUsersService, LoggerService, PrismaService],
controllers: [LinkedUsersController],
})
export class LinkedUsersModule {}
18 changes: 18 additions & 0 deletions packages/api/src/@core/linked-users/linked-users.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { LinkedUsersService } from './linked-users.service';

describe('LinkedUsersService', () => {
let service: LinkedUsersService;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [LinkedUsersService],
}).compile();

service = module.get<LinkedUsersService>(LinkedUsersService);
});

it('should be defined', () => {
expect(service).toBeDefined();
});
});
23 changes: 23 additions & 0 deletions packages/api/src/@core/linked-users/linked-users.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Injectable } from '@nestjs/common';
import { CreateLinkedUserDto } from './dto/create-linked-user.dto';
import { PrismaService } from '../prisma/prisma.service';
import { LoggerService } from '../logger/logger.service';

@Injectable()
export class LinkedUsersService {
constructor(private prisma: PrismaService, private logger: LoggerService) {
this.logger.setContext(LinkedUsersService.name);
}

async addLinkedUser(data: CreateLinkedUserDto) {
const { id_project, ...rest } = data;
const res = await this.prisma.linked_users.create({
data: {
...rest,
id_project: Number(id_project),
status: data.status || 'active',
},
});
//this.logger.log('Added new linked_user ' + data);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export class CreateOrganizationDto {
name: string;
stripe_customer_id: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { OrganisationsController } from './organisations.controller';

describe('OrganisationsController', () => {
let controller: OrganisationsController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [OrganisationsController],
}).compile();

controller = module.get<OrganisationsController>(OrganisationsController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
});
});
19 changes: 19 additions & 0 deletions packages/api/src/@core/organisations/organisations.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Body, Controller, Post } from '@nestjs/common';
import { OrganisationsService } from './organisations.service';
import { LoggerService } from '../logger/logger.service';
import { CreateOrganizationDto } from './dto/create-organization.dto';

@Controller('organisations')
export class OrganisationsController {
constructor(
private readonly organizationsService: OrganisationsService,
private logger: LoggerService,
) {
this.logger.setContext(OrganisationsController.name);
}

@Post('create')
createProject(@Body() orgCreateDto: CreateOrganizationDto) {
return this.organizationsService.createOrganization(orgCreateDto);
}
}
6 changes: 5 additions & 1 deletion packages/api/src/@core/organisations/organisations.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { Module } from '@nestjs/common';
import { OrganisationsService } from './organisations.service';
import { OrganisationsController } from './organisations.controller';
import { PrismaService } from '../prisma/prisma.service';
import { LoggerService } from '../logger/logger.service';

@Module({
providers: [OrganisationsService],
providers: [OrganisationsService, PrismaService, LoggerService],
controllers: [OrganisationsController],
})
export class OrganisationsModule {}
13 changes: 10 additions & 3 deletions packages/api/src/@core/organisations/organisations.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import { Injectable } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
import { LoggerService } from '../logger/logger.service';
import { CreateOrganizationDto } from './dto/create-organization.dto';

@Injectable()
export class OrganisationsService {
//TODO
async createOrganization() {
return;
constructor(private prisma: PrismaService, private logger: LoggerService) {
this.logger.setContext(OrganisationsService.name);
}
async createOrganization(data: CreateOrganizationDto) {
const res = await this.prisma.organizations.create({
data: data,
});
}
}
4 changes: 4 additions & 0 deletions packages/api/src/@core/projects/dto/create-project.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export class CreateProjectDto {
name: string;
id_organization: string;
}
18 changes: 18 additions & 0 deletions packages/api/src/@core/projects/projects.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { ProjectsController } from './projects.controller';

describe('ProjectsController', () => {
let controller: ProjectsController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [ProjectsController],
}).compile();

controller = module.get<ProjectsController>(ProjectsController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
});
});
19 changes: 19 additions & 0 deletions packages/api/src/@core/projects/projects.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Body, Controller, Post } from '@nestjs/common';
import { ProjectsService } from './projects.service';
import { LoggerService } from '../logger/logger.service';
import { CreateProjectDto } from './dto/create-project.dto';

@Controller('projects')
export class ProjectsController {
constructor(
private readonly projectsService: ProjectsService,
private logger: LoggerService,
) {
this.logger.setContext(ProjectsController.name);
}

@Post('create')
createProject(@Body() projectCreateDto: CreateProjectDto) {
return this.projectsService.createProject(projectCreateDto);
}
}
6 changes: 5 additions & 1 deletion packages/api/src/@core/projects/projects.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { Module } from '@nestjs/common';
import { ProjectsService } from './projects.service';
import { ProjectsController } from './projects.controller';
import { LoggerService } from '../logger/logger.service';
import { PrismaService } from '../prisma/prisma.service';

@Module({
providers: [ProjectsService]
providers: [ProjectsService, LoggerService, PrismaService],
controllers: [ProjectsController],
})
export class ProjectsModule {}
17 changes: 14 additions & 3 deletions packages/api/src/@core/projects/projects.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
import { Injectable } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
import { LoggerService } from '../logger/logger.service';
import { CreateProjectDto } from './dto/create-project.dto';

@Injectable()
export class ProjectsService {
//TODO
async createProject() {
return;
constructor(private prisma: PrismaService, private logger: LoggerService) {
this.logger.setContext(ProjectsService.name);
}
async createProject(data: CreateProjectDto) {
const { id_organization, ...rest } = data;
const res = await this.prisma.projects.create({
data: {
...rest,
id_organization: Number(id_organization),
},
});
}
}
6 changes: 6 additions & 0 deletions packages/api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ import { AccountingModule } from './accounting/accounting.module';
import { FileStorageModule } from './file-storage/file-storage.module';
import { SentryInterceptor, SentryModule } from '@ntegral/nestjs-sentry';
import { APP_INTERCEPTOR } from '@nestjs/core';
import { LinkedUsersModule } from './@core/linked-users/linked-users.module';
import { OrganisationsModule } from './@core/organisations/organisations.module';
import { ProjectsModule } from './@core/projects/projects.module';

@Module({
imports: [
LinkedUsersModule,
OrganisationsModule,
ProjectsModule,
TicketingModule,
HrisModule,
MarketingAutomationModule,
Expand Down
8 changes: 5 additions & 3 deletions packages/frontend-snippet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"version": "0.0.0",
"type": "module",
"engines": {
"node": ">=16.14.2 <19.0.0"
},
"node": ">=16.14.2 <19.0.0"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
Expand All @@ -15,7 +15,9 @@
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-loader-spinner": "^5.4.5",
"tailwind-scrollbar-hide": "^1.1.7"
},
"devDependencies": {
"@types/react": "^18.2.15",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/frontend-snippet/public/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 4 additions & 11 deletions packages/frontend-snippet/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import './App.css'
import useOAuth from './hooks/useOAuth';
import ProviderModal from './lib/ProviderModal';
import { CRM_PROVIDERS } from './helpers/utils';
import WalletModal from './components/newCatalogue';

function App() {
const [isModalOpen, setIsModalOpen] = useState(false);
/*const [isModalOpen, setIsModalOpen] = useState(false);
const [providerId, setProviderId] = useState("");
const [returnUrl, setReturnUrl] = useState("http://127.0.0.1:5173/");
const [projectId, setPojectId] = useState("1");
Expand Down Expand Up @@ -53,19 +54,11 @@ function App() {
}
open();
setIsModalOpen(false);
};
};*/
return (
<>
<h1 className='text-5xl font-bold'>Integrations Flow</h1>
<div className="card">
<button disabled={!isReady} onClick={() => setIsModalOpen(true)}>
Start OAuth Flow
</button>
<ProviderModal
isOpen={isModalOpen}
onSelectProvider={handleProviderSelection}
onClose={() => setIsModalOpen(false)}
/>
<WalletModal/>
</div>
</>
)
Expand Down
Loading

0 comments on commit 0dcfeb7

Please sign in to comment.