Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev' into fix-36
Browse files Browse the repository at this point in the history
  • Loading branch information
Jemiiah authored Nov 25, 2024
2 parents 24337db + eeb9648 commit fecb15d
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 537 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ scarb build

## License

This project is licensed under the MIT License. See [License](./LICENSE) for more information
This project is licensed under the MIT License. See [License](https://opensource.org/license/mit) for more information

## Contributing
For more info and guidance on contributing, join the contributors Telegram group: https://t.me/+p5JGJ4C8lCw5NjNk
Expand Down
10 changes: 9 additions & 1 deletion backend/src/manufacturer/manufacturer.controller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { Controller } from '@nestjs/common';
import { Controller, Post, Body } from '@nestjs/common';
import { ManufacturerService } from './manufacturer.service';
import { CreateManufacturerDto } from './dto/create-manufacturer.dto';

@Controller('manufacturer')
export class ManufacturerController {
constructor(private readonly manufacturerService: ManufacturerService) {}

@Post('register')
async registerManufacturer(
@Body() createManufacturerDto: CreateManufacturerDto
) {
return this.manufacturerService.registerManufacturer(createManufacturerDto);
}
}
30 changes: 29 additions & 1 deletion backend/src/manufacturer/manufacturer.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
import { Injectable } from '@nestjs/common';
import {
Injectable,
ConflictException,
InternalServerErrorException,
} from '@nestjs/common';
import { PrismaService } from 'src/prisma/prisma.service';
import { CreateManufacturerDto } from './dto/create-manufacturer.dto';

@Injectable()
export class ManufacturerService {
constructor(private readonly prisma: PrismaService) {}

async registerManufacturer(createManufacturerDto: CreateManufacturerDto) {
const { name, address, email, rc, phone } = createManufacturerDto;

try {
return await this.prisma.manufacturer.create({
data: {
name,
address,
email,
rc,
phone,
},
});
} catch (error) {
if (error.code === 'P2002') {
throw new ConflictException(
'Manufacturer with this email or name already exists'
);
}
throw new InternalServerErrorException('Failed to register manufacturer');
}
}
}
194 changes: 0 additions & 194 deletions frontend/src/app/components/ConnectModal.tsx

This file was deleted.

Loading

0 comments on commit fecb15d

Please sign in to comment.