feat: add consumer accounts and business activities management
- Implemented AccountsService for managing consumer accounts including create, update, delete, and find operations. - Created DTOs for account creation and updates. - Developed BusinessActivitiesController and BusinessActivitiesService for handling business activities related to consumers. - Added complexes management with ComplexesController and ComplexesService. - Introduced POS management with ComplexPosesController and ComplexPosesService. - Created necessary DTOs for business activities and POS. - Established Licenses management with LicensesController and LicensesService. - Integrated consumer management with PartnerConsumersController and PartnerConsumersService. - Added Prisma module imports and service connections across modules.
This commit is contained in:
@@ -2,7 +2,6 @@ import { ComplexSelect } from '@/generated/prisma/models'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import { CreateComplexDto, UpdateComplexDto } from './dto/complex.dto'
|
||||
|
||||
@Injectable()
|
||||
export class BusinessActivityComplexesService {
|
||||
@@ -47,40 +46,40 @@ export class BusinessActivityComplexesService {
|
||||
return ResponseMapper.single(account)
|
||||
}
|
||||
|
||||
async create(business_id: string, data: CreateComplexDto) {
|
||||
const account = await this.prisma.complex.create({
|
||||
data: {
|
||||
...data,
|
||||
business_activity: {
|
||||
connect: {
|
||||
id: business_id,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
return ResponseMapper.create(account)
|
||||
}
|
||||
// async create(business_id: string, data: CreateComplexDto) {
|
||||
// const account = await this.prisma.complex.create({
|
||||
// data: {
|
||||
// ...data,
|
||||
// business_activity: {
|
||||
// connect: {
|
||||
// id: business_id,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
// return ResponseMapper.create(account)
|
||||
// }
|
||||
|
||||
async update(
|
||||
consumer_id: string,
|
||||
business_activity_id: string,
|
||||
id: string,
|
||||
data: UpdateComplexDto,
|
||||
) {
|
||||
const account = await this.prisma.complex.update({
|
||||
where: {
|
||||
business_activity: {
|
||||
id: business_activity_id,
|
||||
consumer: {
|
||||
id: consumer_id,
|
||||
},
|
||||
},
|
||||
id,
|
||||
},
|
||||
data,
|
||||
})
|
||||
return ResponseMapper.update(account)
|
||||
}
|
||||
// async update(
|
||||
// consumer_id: string,
|
||||
// business_activity_id: string,
|
||||
// id: string,
|
||||
// data: UpdateComplexDto,
|
||||
// ) {
|
||||
// const account = await this.prisma.complex.update({
|
||||
// where: {
|
||||
// business_activity: {
|
||||
// id: business_activity_id,
|
||||
// consumer: {
|
||||
// id: consumer_id,
|
||||
// },
|
||||
// },
|
||||
// id,
|
||||
// },
|
||||
// data,
|
||||
// })
|
||||
// return ResponseMapper.update(account)
|
||||
// }
|
||||
|
||||
// async delete(id: string) {
|
||||
// await this.prisma.complex.delete({ where: { id } })
|
||||
|
||||
Reference in New Issue
Block a user