Skip to content

Commit

Permalink
[back] 🐛 fix: empiration date notification prisma mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnPetros committed Dec 1, 2024
1 parent af78fef commit 8a8a0ed
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { ExpirationDateNotification } from '@stocker/core/entities'
import type { PrismaExpirationDateNotification } from '../types'
import { PrismaBatchesMapper } from './prisma-batches-mapper'

export class PrismaExpirationDateNotificationMapper {
toDomain(
prismaExpirationDateNotification: PrismaExpirationDateNotification,
): ExpirationDateNotification {
const batchMapper = new PrismaBatchesMapper()

return ExpirationDateNotification.create({
id: prismaExpirationDateNotification.id,
batch: {
id: prismaExpirationDateNotification.batch_id,
code: prismaExpirationDateNotification.Batch.code,
},
batchDto: batchMapper.toDomain(prismaExpirationDateNotification.batch).dto,
sentAt: prismaExpirationDateNotification.registered_at,
companyId: prismaExpirationDateNotification.company_id,
})
Expand All @@ -19,14 +19,13 @@ export class PrismaExpirationDateNotificationMapper {
toPrisma(
expirationDateNotification: ExpirationDateNotification,
): PrismaExpirationDateNotification {
const batchMapper = new PrismaBatchesMapper()

return {
id: expirationDateNotification.id,
registered_at: expirationDateNotification.sentAt,
batch_id: expirationDateNotification.batch.id,
Batch: {
id: expirationDateNotification.batch.id,
code: expirationDateNotification.batch.code,
},
batch: batchMapper.toPrisma(expirationDateNotification.batch),
company_id: expirationDateNotification.companyId,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export const EmployeesCards = async () => {
<Card
title='Funcionários'
value={response.body.employeesCount}
href='/records/employees'
href='/records/employees?role=employee'
icon='user'
/>
<Card
title='Gerentes'
value={response.body.managersCount}
href='/records/employees'
href='/records/employees?role=manager'
icon='user'
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const RolesControl = ({ roles, companyId }: RolesControlProps) => {
<h2 className='text-2xl text-zinc-800 font-bold'>Controle de permissões</h2>
<h3 className='text-xl text-zinc-800 mt-3 font-medium'>Gerente</h3>
<Divider className='mt-3' />
<div className='grid grid-cols-4 gap-3 mt-3'>
<div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 lg:gap-3 mt-3'>
{Object.keys(ROLE_PERMISSIONS).map((permission) => (
<Switch
key={permission}
Expand All @@ -61,7 +61,7 @@ export const RolesControl = ({ roles, companyId }: RolesControlProps) => {
</div>
<h3 className='text-xl text-zinc-800 mt-6 font-medium'>Funcionário</h3>
<Divider className='mt-3' />
<div className='grid grid-cols-4 gap-3 mt-3'>
<div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 lg:gap-3 mt-3'>
{Object.keys(ROLE_PERMISSIONS).map((permission) => (
<Switch
key={permission}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Category } from '../../domain/entities/category'
import type { CategoryDto } from '../../dtos'
import { ConflictError } from '../../errors'
import type { ICategoriesRepository } from '../../interfaces/repositories/categories-repository'

type Request = {
Expand Down

0 comments on commit 8a8a0ed

Please sign in to comment.