feat: add stock keeping unit management with create, update, and retrieval functionalities
- Implemented CreateStockKeepingUnitDto for creating stock keeping units. - Added StockKeepingUnitsService for handling business logic related to stock keeping units. - Created StockKeepingUnitsController to manage HTTP requests for stock keeping units. - Developed UpdateStockKeepingUnitDto for updating existing stock keeping units. - Introduced StockKeepingUnitsServiceFindAllResponseDto for response structure. - Established stock keeping units module for encapsulation of related components. feat: enhance sales invoice fiscal management with new endpoints - Created SalesInvoicesFilterDto for filtering sales invoices. - Implemented PosSalesInvoiceFiscalController for managing fiscal operations on sales invoices. - Developed PosSalesInvoiceFiscalService to handle fiscal logic and interactions. - Added methods for sending, retrying, and checking the status of fiscal invoices. - Integrated error handling and response mapping for fiscal operations.
This commit is contained in:
@@ -2,7 +2,15 @@ import { PublicWithToken } from '@/common/decorators/withToken.decorator'
|
||||
import { Controller, Get, Param } from '@nestjs/common'
|
||||
import { ApiTags } from '@nestjs/swagger'
|
||||
import { CatalogsService } from './catalog.service'
|
||||
import type { CatalogsServiceGetDeviceBrandsResponseDto, CatalogsServiceGetDevicesResponseDto, CatalogsServiceGetGuildGoodCategoriesResponseDto, CatalogsServiceGetGuildsResponseDto, CatalogsServiceGetProvidersResponseDto } from './dto/catalog-response.dto'
|
||||
import type {
|
||||
CatalogsServiceGetDeviceBrandsResponseDto,
|
||||
CatalogsServiceGetDevicesResponseDto,
|
||||
CatalogsServiceGetGuildGoodCategoriesResponseDto,
|
||||
CatalogsServiceGetGuildsResponseDto,
|
||||
CatalogsServiceGetMeasurementsResponseDto,
|
||||
CatalogsServiceGetProvidersResponseDto,
|
||||
CatalogsServiceGetSKUResponseDto,
|
||||
} from './dto/catalog-response.dto'
|
||||
|
||||
@ApiTags('Catalog')
|
||||
@Controller('catalog')
|
||||
@@ -33,9 +41,27 @@ export class CatalogsController {
|
||||
return this.catalogService.getDeviceBrands()
|
||||
}
|
||||
|
||||
@Get('sku')
|
||||
@PublicWithToken()
|
||||
async getSKU(
|
||||
@Param('search') search: string,
|
||||
): Promise<CatalogsServiceGetSKUResponseDto> {
|
||||
return this.catalogService.getSKU(search)
|
||||
}
|
||||
|
||||
@Get('measure_units')
|
||||
@PublicWithToken()
|
||||
async getMeasurements(
|
||||
@Param('search') search: string,
|
||||
): Promise<CatalogsServiceGetMeasurementsResponseDto> {
|
||||
return this.catalogService.getMeasurements()
|
||||
}
|
||||
|
||||
@Get('guilds/:guildId/good_categories')
|
||||
@PublicWithToken()
|
||||
async getGuildGoodCategories(@Param('guildId') guild_id: string): Promise<CatalogsServiceGetGuildGoodCategoriesResponseDto> {
|
||||
async getGuildGoodCategories(
|
||||
@Param('guildId') guild_id: string,
|
||||
): Promise<CatalogsServiceGetGuildGoodCategoriesResponseDto> {
|
||||
return this.catalogService.getGuildGoodCategories(guild_id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,35 @@ export class CatalogsService {
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
async getMeasurements() {
|
||||
const items = await this.prisma.measureUnits.findMany({
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
code: true,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
async getSKU(search: string) {
|
||||
const items = await this.prisma.stockKeepingUnits.findMany({
|
||||
// where: {
|
||||
// OR: [{ code: { contains: search } }, { name: { contains: search } }],
|
||||
// },
|
||||
select: {
|
||||
id: true,
|
||||
code: true,
|
||||
name: true,
|
||||
is_domestic: true,
|
||||
is_public: true,
|
||||
VAT: true,
|
||||
},
|
||||
take: 100,
|
||||
})
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
async getGuildGoodCategories(guild_id: string) {
|
||||
const items = await this.prisma.goodCategory.findMany({
|
||||
where: {
|
||||
|
||||
@@ -1,7 +1,23 @@
|
||||
import type { CatalogsService } from '../catalog.service'
|
||||
|
||||
export type CatalogsServiceGetDeviceBrandsResponseDto = Awaited<ReturnType<CatalogsService['getDeviceBrands']>>
|
||||
export type CatalogsServiceGetDevicesResponseDto = Awaited<ReturnType<CatalogsService['getDevices']>>
|
||||
export type CatalogsServiceGetGuildGoodCategoriesResponseDto = Awaited<ReturnType<CatalogsService['getGuildGoodCategories']>>
|
||||
export type CatalogsServiceGetGuildsResponseDto = Awaited<ReturnType<CatalogsService['getGuilds']>>
|
||||
export type CatalogsServiceGetProvidersResponseDto = Awaited<ReturnType<CatalogsService['getProviders']>>
|
||||
export type CatalogsServiceGetDeviceBrandsResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getDeviceBrands']>
|
||||
>
|
||||
export type CatalogsServiceGetDevicesResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getDevices']>
|
||||
>
|
||||
export type CatalogsServiceGetGuildGoodCategoriesResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getGuildGoodCategories']>
|
||||
>
|
||||
export type CatalogsServiceGetGuildsResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getGuilds']>
|
||||
>
|
||||
export type CatalogsServiceGetProvidersResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getProviders']>
|
||||
>
|
||||
export type CatalogsServiceGetSKUResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getSKU']>
|
||||
>
|
||||
export type CatalogsServiceGetMeasurementsResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getMeasurements']>
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user