feat: Refactor accounts service and related DTOs to enhance consumer account management
- Updated AccountsService to filter out OWNER roles in findAll method. - Removed CreateConsumerAccountDto and its role property from account creation logic. - Enhanced BusinessActivitiesService to include complex counts in responses. - Modified ComplexesController and ComplexesService to handle consumer-specific logic. - Introduced CreateConsumerComplexDto and UpdateConsumerComplexDto for complex management. - Updated PosesController and PosesService to manage POS creation and updates with consumer context. - Added utility function to calculate remaining accounts for business activities. - Updated Prisma migration to add account_id to poses and enforce unique constraints.
This commit is contained in:
@@ -21,7 +21,12 @@ export class PosesService {
|
||||
where: this.defaultWhere(consumer_id),
|
||||
select: this.defaultSelect,
|
||||
})
|
||||
return ResponseMapper.list(poses)
|
||||
return ResponseMapper.list(
|
||||
poses.map((pos: any) => ({
|
||||
...pos,
|
||||
account: { username: pos.account.account.username },
|
||||
})),
|
||||
)
|
||||
}
|
||||
|
||||
async findOne(consumer_id: string, id: string) {
|
||||
@@ -29,7 +34,13 @@ export class PosesService {
|
||||
where: { ...this.defaultWhere(consumer_id), id },
|
||||
select: this.defaultSelect,
|
||||
})
|
||||
return ResponseMapper.single(pos)
|
||||
|
||||
// @ts-ignore
|
||||
const { username } = pos.account?.account
|
||||
return ResponseMapper.single({
|
||||
...pos,
|
||||
account: { username },
|
||||
})
|
||||
}
|
||||
|
||||
async update(consumer_id: string, id: string, data: any) {
|
||||
|
||||
Reference in New Issue
Block a user