feat: add generated code
This commit is contained in:
48
backend/prisma/schema.prisma
Normal file
48
backend/prisma/schema.prisma
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
datasource db {
|
||||||
|
provider = "postgresql"
|
||||||
|
url = env("DATABASE_URL")
|
||||||
|
}
|
||||||
|
|
||||||
|
generator client {
|
||||||
|
provider = "prisma-client-js"
|
||||||
|
}
|
||||||
|
|
||||||
|
enum EquipmentStatus {
|
||||||
|
Active
|
||||||
|
Repair
|
||||||
|
Reserve
|
||||||
|
WriteOff
|
||||||
|
}
|
||||||
|
|
||||||
|
model Equipment {
|
||||||
|
id String @id @default(uuid())
|
||||||
|
name String
|
||||||
|
serialNumber String
|
||||||
|
dateOfInspection DateTime?
|
||||||
|
commissionedAt DateTime?
|
||||||
|
status EquipmentStatus
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
// Relations
|
||||||
|
changeEquipmentStatuses ChangeEquipmentStatus[]
|
||||||
|
|
||||||
|
@@map("equipment")
|
||||||
|
}
|
||||||
|
|
||||||
|
model ChangeEquipmentStatus {
|
||||||
|
id String @id @default(uuid())
|
||||||
|
equipmentId String
|
||||||
|
newStatus EquipmentStatus
|
||||||
|
number String?
|
||||||
|
date DateTime
|
||||||
|
responsible String?
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
// Relations
|
||||||
|
equipment Equipment @relation(fields: [equipmentId], references: [id])
|
||||||
|
|
||||||
|
@@unique([equipmentId, newStatus])
|
||||||
|
@@map("change_equipment_status")
|
||||||
|
}
|
||||||
15
backend/src/app.module.ts
Normal file
15
backend/src/app.module.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { EquipmentModule } from './equipment/equipment.module';
|
||||||
|
import { ChangeEquipmentStatusModule } from './change-equipment-status/change-equipment-status.module';
|
||||||
|
import { AuthModule } from './auth/auth.module';
|
||||||
|
import { PrismaService } from './prisma/prisma.service';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
imports: [
|
||||||
|
EquipmentModule,
|
||||||
|
ChangeEquipmentStatusModule,
|
||||||
|
AuthModule,
|
||||||
|
],
|
||||||
|
providers: [PrismaService],
|
||||||
|
})
|
||||||
|
export class AppModule {}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
import { Controller, Get, Post, Body, Put, Param, Delete, Query, UseGuards } from '@nestjs/common';
|
||||||
|
import { ApiBearerAuth, ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
|
||||||
|
import { ChangeEquipmentStatusService } from './change-equipment-status.service';
|
||||||
|
import { CreateChangeEquipmentStatusDto } from './dto/create-change-equipment-status.dto';
|
||||||
|
import { UpdateChangeEquipmentStatusDto } from './dto/update-change-equipment-status.dto';
|
||||||
|
import { ChangeEquipmentStatusListRequestDto } from './dto/change-equipment-status-list-request.dto';
|
||||||
|
import { ChangeEquipmentStatusListResponseDto } from './dto/change-equipment-status-list-response.dto';
|
||||||
|
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||||
|
import { EquipmentStatus } from '@prisma/client';
|
||||||
|
|
||||||
|
@ApiTags('change-equipment-status')
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@UseGuards(JwtAuthGuard)
|
||||||
|
@Controller('change-equipment-status')
|
||||||
|
export class ChangeEquipmentStatusController {
|
||||||
|
constructor(private readonly changeEquipmentStatusService: ChangeEquipmentStatusService) {}
|
||||||
|
|
||||||
|
@Post('page')
|
||||||
|
@ApiOperation({ summary: 'Постраничный список документов изменения статуса с фильтрацией' })
|
||||||
|
@ApiResponse({
|
||||||
|
status: 200,
|
||||||
|
description: 'Список документов изменения статуса',
|
||||||
|
type: ChangeEquipmentStatusListResponseDto
|
||||||
|
})
|
||||||
|
async findAll(
|
||||||
|
@Body() dto: ChangeEquipmentStatusListRequestDto,
|
||||||
|
) {
|
||||||
|
const { page, filter } = dto;
|
||||||
|
const skip = page?.page ? page.page * page.size : 0;
|
||||||
|
const take = page?.size || 25;
|
||||||
|
|
||||||
|
const where = filter ? this.buildWhereClause(filter) : {};
|
||||||
|
|
||||||
|
const [content, total] = await Promise.all([
|
||||||
|
this.changeEquipmentStatusService.findAll({ skip, take, where }),
|
||||||
|
this.changeEquipmentStatusService.count(where)
|
||||||
|
]);
|
||||||
|
|
||||||
|
return {
|
||||||
|
content,
|
||||||
|
pageInfo: {
|
||||||
|
page: page?.page || 0,
|
||||||
|
size: take,
|
||||||
|
total,
|
||||||
|
totalPages: Math.ceil(total / take),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get(':equipmentId/:newStatus')
|
||||||
|
@ApiOperation({ summary: 'Получить документ изменения статуса по ключу' })
|
||||||
|
@ApiResponse({ status: 200, description: 'Документ изменения статуса найден' })
|
||||||
|
@ApiResponse({ status: 404, description: 'Документ изменения статуса не найден' })
|
||||||
|
findOne(
|
||||||
|
@Param('equipmentId') equipmentId: string,
|
||||||
|
@Param('newStatus') newStatus: EquipmentStatus,
|
||||||
|
) {
|
||||||
|
return this.changeEquipmentStatusService.findOne({
|
||||||
|
equipmentId_newStatus: { equipmentId, newStatus }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Создать документ изменения статуса' })
|
||||||
|
@ApiResponse({ status: 201, description: 'Документ изменения статуса создан' })
|
||||||
|
create(@Body() dto: CreateChangeEquipmentStatusDto) {
|
||||||
|
return this.changeEquipmentStatusService.create(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Put(':equipmentId/:newStatus')
|
||||||
|
@ApiOperation({ summary: 'Обновить документ изменения статуса' })
|
||||||
|
@ApiResponse({ status: 200, description: 'Документ изменения статуса обновлен' })
|
||||||
|
@ApiResponse({ status: 404, description: 'Документ изменения статуса не найден' })
|
||||||
|
update(
|
||||||
|
@Param('equipmentId') equipmentId: string,
|
||||||
|
@Param('newStatus') newStatus: EquipmentStatus,
|
||||||
|
@Body() dto: UpdateChangeEquipmentStatusDto,
|
||||||
|
) {
|
||||||
|
return this.changeEquipmentStatusService.update({
|
||||||
|
where: { equipmentId_newStatus: { equipmentId, newStatus } },
|
||||||
|
data: dto
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete(':equipmentId/:newStatus')
|
||||||
|
@ApiOperation({ summary: 'Удалить документ изменения статуса' })
|
||||||
|
@ApiResponse({ status: 200, description: 'Документ изменения статуса удален' })
|
||||||
|
@ApiResponse({ status: 404, description: 'Документ изменения статуса не найден' })
|
||||||
|
remove(
|
||||||
|
@Param('equipmentId') equipmentId: string,
|
||||||
|
@Param('newStatus') newStatus: EquipmentStatus,
|
||||||
|
) {
|
||||||
|
return this.changeEquipmentStatusService.remove({
|
||||||
|
equipmentId_newStatus: { equipmentId, newStatus }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildWhereClause(filter: any): any {
|
||||||
|
// Basic implementation - can be extended based on filter structure
|
||||||
|
const where: any = {};
|
||||||
|
|
||||||
|
if (filter.equipmentId) {
|
||||||
|
where.equipmentId = filter.equipmentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.newStatus) {
|
||||||
|
where.newStatus = filter.newStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.number) {
|
||||||
|
where.number = { contains: filter.number, mode: 'insensitive' };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.responsible) {
|
||||||
|
where.responsible = { contains: filter.responsible, mode: 'insensitive' };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.dateFrom || filter.dateTo) {
|
||||||
|
where.date = {};
|
||||||
|
if (filter.dateFrom) {
|
||||||
|
where.date.gte = new Date(filter.dateFrom);
|
||||||
|
}
|
||||||
|
if (filter.dateTo) {
|
||||||
|
where.date.lte = new Date(filter.dateTo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return where;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { ChangeEquipmentStatusService } from './change-equipment-status.service';
|
||||||
|
import { ChangeEquipmentStatusController } from './change-equipment-status.controller';
|
||||||
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
controllers: [ChangeEquipmentStatusController],
|
||||||
|
providers: [ChangeEquipmentStatusService, PrismaService],
|
||||||
|
})
|
||||||
|
export class ChangeEquipmentStatusModule {}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
|
import { ChangeEquipmentStatus, Prisma } from '@prisma/client';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class ChangeEquipmentStatusService {
|
||||||
|
constructor(private prisma: PrismaService) {}
|
||||||
|
|
||||||
|
async findAll(params: {
|
||||||
|
skip?: number;
|
||||||
|
take?: number;
|
||||||
|
where?: Prisma.ChangeEquipmentStatusWhereInput;
|
||||||
|
orderBy?: Prisma.ChangeEquipmentStatusOrderByWithRelationInput;
|
||||||
|
}): Promise<ChangeEquipmentStatus[]> {
|
||||||
|
const { skip, take, where, orderBy } = params;
|
||||||
|
return this.prisma.changeEquipmentStatus.findMany({
|
||||||
|
skip,
|
||||||
|
take,
|
||||||
|
where,
|
||||||
|
orderBy,
|
||||||
|
include: {
|
||||||
|
equipment: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async count(where?: Prisma.ChangeEquipmentStatusWhereInput): Promise<number> {
|
||||||
|
return this.prisma.changeEquipmentStatus.count({ where });
|
||||||
|
}
|
||||||
|
|
||||||
|
async findOne(where: Prisma.ChangeEquipmentStatusWhereUniqueInput): Promise<ChangeEquipmentStatus | null> {
|
||||||
|
return this.prisma.changeEquipmentStatus.findUnique({
|
||||||
|
where,
|
||||||
|
include: {
|
||||||
|
equipment: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async create(data: Prisma.ChangeEquipmentStatusCreateInput): Promise<ChangeEquipmentStatus> {
|
||||||
|
return this.prisma.changeEquipmentStatus.create({
|
||||||
|
data,
|
||||||
|
include: {
|
||||||
|
equipment: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async update(params: {
|
||||||
|
where: Prisma.ChangeEquipmentStatusWhereUniqueInput;
|
||||||
|
data: Prisma.ChangeEquipmentStatusUpdateInput;
|
||||||
|
}): Promise<ChangeEquipmentStatus> {
|
||||||
|
return this.prisma.changeEquipmentStatus.update({
|
||||||
|
...params,
|
||||||
|
include: {
|
||||||
|
equipment: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async remove(where: Prisma.ChangeEquipmentStatusWhereUniqueInput): Promise<ChangeEquipmentStatus> {
|
||||||
|
return this.prisma.changeEquipmentStatus.delete({
|
||||||
|
where,
|
||||||
|
include: {
|
||||||
|
equipment: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
import { IsOptional, ValidateNested } from 'class-validator';
|
||||||
|
import { Type } from 'class-transformer';
|
||||||
|
import { PageRequestDto } from '../../common/dto/page-request.dto';
|
||||||
|
|
||||||
|
export class ChangeEquipmentStatusListRequestDto {
|
||||||
|
@ApiProperty({ description: 'Фильтр', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
filter?: any; // Using any since DTO.Filter is not defined in the schema
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Параметры пагинации' })
|
||||||
|
@ValidateNested()
|
||||||
|
@Type(() => PageRequestDto)
|
||||||
|
page: PageRequestDto;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
import { PageInfoDto } from '../../common/dto/page-info.dto';
|
||||||
|
|
||||||
|
export class ChangeEquipmentStatusListResponseDto {
|
||||||
|
@ApiProperty({ description: 'Список документов изменения статуса', type: () => Object, isArray: true })
|
||||||
|
content: any[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Метаданные пагинации', type: () => PageInfoDto })
|
||||||
|
pageInfo: PageInfoDto;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
import { IsString, IsOptional, IsDateString, IsUUID } from 'class-validator';
|
||||||
|
import { EquipmentStatus } from '@prisma/client';
|
||||||
|
|
||||||
|
export class CreateChangeEquipmentStatusDto {
|
||||||
|
@ApiProperty({ description: 'Оборудование' })
|
||||||
|
@IsUUID()
|
||||||
|
equipmentId: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Новый статус',
|
||||||
|
enum: EquipmentStatus,
|
||||||
|
enumName: 'EquipmentStatus'
|
||||||
|
})
|
||||||
|
newStatus: EquipmentStatus;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Номер', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
number?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Дата изменения статуса' })
|
||||||
|
@IsDateString()
|
||||||
|
date: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Ответственный', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
responsible?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
import { IsString, IsOptional, IsDateString, IsUUID } from 'class-validator';
|
||||||
|
import { EquipmentStatus } from '@prisma/client';
|
||||||
|
import { PartialType } from '@nestjs/swagger';
|
||||||
|
import { CreateChangeEquipmentStatusDto } from './create-change-equipment-status.dto';
|
||||||
|
|
||||||
|
export class UpdateChangeEquipmentStatusDto extends PartialType(CreateChangeEquipmentStatusDto) {
|
||||||
|
@ApiProperty({ description: 'Оборудование', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsUUID()
|
||||||
|
equipmentId?: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Новый статус',
|
||||||
|
enum: EquipmentStatus,
|
||||||
|
enumName: 'EquipmentStatus',
|
||||||
|
required: false
|
||||||
|
})
|
||||||
|
@IsOptional()
|
||||||
|
newStatus?: EquipmentStatus;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Номер', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
number?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Дата изменения статуса', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsDateString()
|
||||||
|
date?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Ответственный', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
responsible?: string;
|
||||||
|
}
|
||||||
15
backend/src/common/dto/page-info.dto.ts
Normal file
15
backend/src/common/dto/page-info.dto.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
|
||||||
|
export class PageInfoDto {
|
||||||
|
@ApiProperty({ description: 'Номер страницы' })
|
||||||
|
page: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Размер страницы' })
|
||||||
|
size: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Общее количество элементов' })
|
||||||
|
total: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Общее количество страниц' })
|
||||||
|
totalPages: number;
|
||||||
|
}
|
||||||
16
backend/src/common/dto/page-request.dto.ts
Normal file
16
backend/src/common/dto/page-request.dto.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
import { IsNumber, IsOptional, Min } from 'class-validator';
|
||||||
|
|
||||||
|
export class PageRequestDto {
|
||||||
|
@ApiProperty({ description: 'Номер страницы', required: false, default: 0 })
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
|
@Min(0)
|
||||||
|
page?: number = 0;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Размер страницы', required: false, default: 25 })
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
|
@Min(1)
|
||||||
|
size?: number = 25;
|
||||||
|
}
|
||||||
32
backend/src/equipment/dto/create-equipment.dto.ts
Normal file
32
backend/src/equipment/dto/create-equipment.dto.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
import { IsString, IsOptional, IsDateString } from 'class-validator';
|
||||||
|
import { EquipmentStatus } from '@prisma/client';
|
||||||
|
|
||||||
|
export class CreateEquipmentDto {
|
||||||
|
@ApiProperty({ description: 'Название оборудования' })
|
||||||
|
@IsString()
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Заводской (серийный) номер' })
|
||||||
|
@IsString()
|
||||||
|
serialNumber: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Дата поверки', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsDateString()
|
||||||
|
dateOfInspection?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Дата изготовления', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsDateString()
|
||||||
|
commissionedAt?: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Текущий статус',
|
||||||
|
enum: EquipmentStatus,
|
||||||
|
enumName: 'EquipmentStatus',
|
||||||
|
required: false
|
||||||
|
})
|
||||||
|
@IsOptional()
|
||||||
|
status?: EquipmentStatus;
|
||||||
|
}
|
||||||
15
backend/src/equipment/dto/equipment-list-request.dto.ts
Normal file
15
backend/src/equipment/dto/equipment-list-request.dto.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
import { IsOptional, ValidateNested } from 'class-validator';
|
||||||
|
import { Type } from 'class-transformer';
|
||||||
|
import { PageRequestDto } from '../../common/dto/page-request.dto';
|
||||||
|
|
||||||
|
export class EquipmentListRequestDto {
|
||||||
|
@ApiProperty({ description: 'Фильтр', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
filter?: any; // Using any since DTO.Filter is not defined in the schema
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Параметры пагинации' })
|
||||||
|
@ValidateNested()
|
||||||
|
@Type(() => PageRequestDto)
|
||||||
|
page: PageRequestDto;
|
||||||
|
}
|
||||||
10
backend/src/equipment/dto/equipment-list-response.dto.ts
Normal file
10
backend/src/equipment/dto/equipment-list-response.dto.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
import { PageInfoDto } from '../../common/dto/page-info.dto';
|
||||||
|
|
||||||
|
export class EquipmentListResponseDto {
|
||||||
|
@ApiProperty({ description: 'Список оборудования', type: () => Object, isArray: true })
|
||||||
|
content: any[];
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Метаданные пагинации', type: () => PageInfoDto })
|
||||||
|
pageInfo: PageInfoDto;
|
||||||
|
}
|
||||||
36
backend/src/equipment/dto/update-equipment.dto.ts
Normal file
36
backend/src/equipment/dto/update-equipment.dto.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
import { IsString, IsOptional, IsDateString } from 'class-validator';
|
||||||
|
import { EquipmentStatus } from '@prisma/client';
|
||||||
|
import { PartialType } from '@nestjs/swagger';
|
||||||
|
import { CreateEquipmentDto } from './create-equipment.dto';
|
||||||
|
|
||||||
|
export class UpdateEquipmentDto extends PartialType(CreateEquipmentDto) {
|
||||||
|
@ApiProperty({ description: 'Название оборудования', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
name?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Заводской (серийный) номер', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
serialNumber?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Дата поверки', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsDateString()
|
||||||
|
dateOfInspection?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Дата изготовления', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsDateString()
|
||||||
|
commissionedAt?: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Текущий статус',
|
||||||
|
enum: EquipmentStatus,
|
||||||
|
enumName: 'EquipmentStatus',
|
||||||
|
required: false
|
||||||
|
})
|
||||||
|
@IsOptional()
|
||||||
|
status?: EquipmentStatus;
|
||||||
|
}
|
||||||
98
backend/src/equipment/equipment.controller.ts
Normal file
98
backend/src/equipment/equipment.controller.ts
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import { Controller, Get, Post, Body, Put, Param, Delete, Query, UseGuards } from '@nestjs/common';
|
||||||
|
import { ApiBearerAuth, ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
|
||||||
|
import { EquipmentService } from './equipment.service';
|
||||||
|
import { CreateEquipmentDto } from './dto/create-equipment.dto';
|
||||||
|
import { UpdateEquipmentDto } from './dto/update-equipment.dto';
|
||||||
|
import { EquipmentListRequestDto } from './dto/equipment-list-request.dto';
|
||||||
|
import { EquipmentListResponseDto } from './dto/equipment-list-response.dto';
|
||||||
|
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||||
|
|
||||||
|
@ApiTags('equipment')
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@UseGuards(JwtAuthGuard)
|
||||||
|
@Controller('equipment')
|
||||||
|
export class EquipmentController {
|
||||||
|
constructor(private readonly equipmentService: EquipmentService) {}
|
||||||
|
|
||||||
|
@Post('page')
|
||||||
|
@ApiOperation({ summary: 'Постраничный список оборудования с фильтрацией' })
|
||||||
|
@ApiResponse({
|
||||||
|
status: 200,
|
||||||
|
description: 'Список оборудования',
|
||||||
|
type: EquipmentListResponseDto
|
||||||
|
})
|
||||||
|
async findAll(
|
||||||
|
@Body() dto: EquipmentListRequestDto,
|
||||||
|
) {
|
||||||
|
const { page, filter } = dto;
|
||||||
|
const skip = page?.page ? page.page * page.size : 0;
|
||||||
|
const take = page?.size || 25;
|
||||||
|
|
||||||
|
const where = filter ? this.buildWhereClause(filter) : {};
|
||||||
|
|
||||||
|
const [content, total] = await Promise.all([
|
||||||
|
this.equipmentService.findAll({ skip, take, where }),
|
||||||
|
this.equipmentService.count(where)
|
||||||
|
]);
|
||||||
|
|
||||||
|
return {
|
||||||
|
content,
|
||||||
|
pageInfo: {
|
||||||
|
page: page?.page || 0,
|
||||||
|
size: take,
|
||||||
|
total,
|
||||||
|
totalPages: Math.ceil(total / take),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get(':id')
|
||||||
|
@ApiOperation({ summary: 'Получить оборудование по идентификатору' })
|
||||||
|
@ApiResponse({ status: 200, description: 'Оборудование найдено' })
|
||||||
|
@ApiResponse({ status: 404, description: 'Оборудование не найдено' })
|
||||||
|
findOne(@Param('id') id: string) {
|
||||||
|
return this.equipmentService.findOne({ id });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post()
|
||||||
|
@ApiOperation({ summary: 'Создать оборудование' })
|
||||||
|
@ApiResponse({ status: 201, description: 'Оборудование создано' })
|
||||||
|
create(@Body() dto: CreateEquipmentDto) {
|
||||||
|
return this.equipmentService.create(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Put(':id')
|
||||||
|
@ApiOperation({ summary: 'Обновить оборудование' })
|
||||||
|
@ApiResponse({ status: 200, description: 'Оборудование обновлено' })
|
||||||
|
@ApiResponse({ status: 404, description: 'Оборудование не найдено' })
|
||||||
|
update(@Param('id') id: string, @Body() dto: UpdateEquipmentDto) {
|
||||||
|
return this.equipmentService.update({ where: { id }, data: dto });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete(':id')
|
||||||
|
@ApiOperation({ summary: 'Удалить оборудование' })
|
||||||
|
@ApiResponse({ status: 200, description: 'Оборудование удалено' })
|
||||||
|
@ApiResponse({ status: 404, description: 'Оборудование не найдено' })
|
||||||
|
remove(@Param('id') id: string) {
|
||||||
|
return this.equipmentService.remove({ id });
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildWhereClause(filter: any): any {
|
||||||
|
// Basic implementation - can be extended based on filter structure
|
||||||
|
const where: any = {};
|
||||||
|
|
||||||
|
if (filter.name) {
|
||||||
|
where.name = { contains: filter.name, mode: 'insensitive' };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.serialNumber) {
|
||||||
|
where.serialNumber = { contains: filter.serialNumber, mode: 'insensitive' };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.status) {
|
||||||
|
where.status = filter.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
return where;
|
||||||
|
}
|
||||||
|
}
|
||||||
10
backend/src/equipment/equipment.module.ts
Normal file
10
backend/src/equipment/equipment.module.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { EquipmentService } from './equipment.service';
|
||||||
|
import { EquipmentController } from './equipment.controller';
|
||||||
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
controllers: [EquipmentController],
|
||||||
|
providers: [EquipmentService, PrismaService],
|
||||||
|
})
|
||||||
|
export class EquipmentModule {}
|
||||||
41
backend/src/equipment/equipment.service.ts
Normal file
41
backend/src/equipment/equipment.service.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
|
import { Equipment, Prisma } from '@prisma/client';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class EquipmentService {
|
||||||
|
constructor(private prisma: PrismaService) {}
|
||||||
|
|
||||||
|
async findAll(params: {
|
||||||
|
skip?: number;
|
||||||
|
take?: number;
|
||||||
|
where?: Prisma.EquipmentWhereInput;
|
||||||
|
orderBy?: Prisma.EquipmentOrderByWithRelationInput;
|
||||||
|
}): Promise<Equipment[]> {
|
||||||
|
const { skip, take, where, orderBy } = params;
|
||||||
|
return this.prisma.equipment.findMany({ skip, take, where, orderBy });
|
||||||
|
}
|
||||||
|
|
||||||
|
async count(where?: Prisma.EquipmentWhereInput): Promise<number> {
|
||||||
|
return this.prisma.equipment.count({ where });
|
||||||
|
}
|
||||||
|
|
||||||
|
async findOne(where: Prisma.EquipmentWhereUniqueInput): Promise<Equipment | null> {
|
||||||
|
return this.prisma.equipment.findUnique({ where });
|
||||||
|
}
|
||||||
|
|
||||||
|
async create(data: Prisma.EquipmentCreateInput): Promise<Equipment> {
|
||||||
|
return this.prisma.equipment.create({ data });
|
||||||
|
}
|
||||||
|
|
||||||
|
async update(params: {
|
||||||
|
where: Prisma.EquipmentWhereUniqueInput;
|
||||||
|
data: Prisma.EquipmentUpdateInput;
|
||||||
|
}): Promise<Equipment> {
|
||||||
|
return this.prisma.equipment.update(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
async remove(where: Prisma.EquipmentWhereUniqueInput): Promise<Equipment> {
|
||||||
|
return this.prisma.equipment.delete({ where });
|
||||||
|
}
|
||||||
|
}
|
||||||
36
frontend/src/App.tsx
Normal file
36
frontend/src/App.tsx
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import { Admin, Resource } from 'react-admin';
|
||||||
|
import { dataProvider } from './dataProvider';
|
||||||
|
import { authProvider } from './authProvider';
|
||||||
|
|
||||||
|
// Equipment resources
|
||||||
|
import { EquipmentList } from './resources/equipment/EquipmentList';
|
||||||
|
import { EquipmentEdit } from './resources/equipment/EquipmentEdit';
|
||||||
|
import { EquipmentCreate } from './resources/equipment/EquipmentCreate';
|
||||||
|
import { EquipmentShow } from './resources/equipment/EquipmentShow';
|
||||||
|
|
||||||
|
// ChangeEquipmentStatus resources
|
||||||
|
import { ChangeEquipmentStatusList } from './resources/change-equipment-status/ChangeEquipmentStatusList';
|
||||||
|
import { ChangeEquipmentStatusEdit } from './resources/change-equipment-status/ChangeEquipmentStatusEdit';
|
||||||
|
import { ChangeEquipmentStatusCreate } from './resources/change-equipment-status/ChangeEquipmentStatusCreate';
|
||||||
|
import { ChangeEquipmentStatusShow } from './resources/change-equipment-status/ChangeEquipmentStatusShow';
|
||||||
|
|
||||||
|
const App = () => (
|
||||||
|
<Admin dataProvider={dataProvider} authProvider={authProvider}>
|
||||||
|
<Resource
|
||||||
|
name="equipment"
|
||||||
|
list={EquipmentList}
|
||||||
|
create={EquipmentCreate}
|
||||||
|
edit={EquipmentEdit}
|
||||||
|
show={EquipmentShow}
|
||||||
|
/>
|
||||||
|
<Resource
|
||||||
|
name="change-equipment-status"
|
||||||
|
list={ChangeEquipmentStatusList}
|
||||||
|
create={ChangeEquipmentStatusCreate}
|
||||||
|
edit={ChangeEquipmentStatusEdit}
|
||||||
|
show={ChangeEquipmentStatusShow}
|
||||||
|
/>
|
||||||
|
</Admin>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default App;
|
||||||
19
frontend/src/main.tsx
Normal file
19
frontend/src/main.tsx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom/client';
|
||||||
|
import { initKeycloak } from './authProvider';
|
||||||
|
import App from './App';
|
||||||
|
|
||||||
|
const root = ReactDOM.createRoot(
|
||||||
|
document.getElementById('root') as HTMLElement
|
||||||
|
);
|
||||||
|
|
||||||
|
// Initialize Keycloak before rendering the app
|
||||||
|
initKeycloak().then(() => {
|
||||||
|
root.render(
|
||||||
|
<React.StrictMode>
|
||||||
|
<App />
|
||||||
|
</React.StrictMode>
|
||||||
|
);
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('Failed to initialize Keycloak:', error);
|
||||||
|
});
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { Create, SimpleForm, TextInput, DateInput, SelectInput, ReferenceInput } from 'react-admin';
|
||||||
|
|
||||||
|
const equipmentStatusChoices = [
|
||||||
|
{ id: 'Active', name: 'В эксплуатации' },
|
||||||
|
{ id: 'Repair', name: 'В ремонте' },
|
||||||
|
{ id: 'Reserve', name: 'В резерве' },
|
||||||
|
{ id: 'WriteOff', name: 'Списано' },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const ChangeEquipmentStatusCreate = () => (
|
||||||
|
<Create>
|
||||||
|
<SimpleForm>
|
||||||
|
<ReferenceInput source="equipmentId" reference="equipment" label="Оборудование" required />
|
||||||
|
<SelectInput
|
||||||
|
source="newStatus"
|
||||||
|
label="Новый статус"
|
||||||
|
choices={equipmentStatusChoices}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<TextInput source="number" label="Номер" fullWidth />
|
||||||
|
<DateInput source="date" label="Дата изменения статуса" required />
|
||||||
|
<TextInput source="responsible" label="Ответственный" fullWidth />
|
||||||
|
</SimpleForm>
|
||||||
|
</Create>
|
||||||
|
);
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { Edit, SimpleForm, TextInput, DateInput, SelectInput, ReferenceInput } from 'react-admin';
|
||||||
|
|
||||||
|
const equipmentStatusChoices = [
|
||||||
|
{ id: 'Active', name: 'В эксплуатации' },
|
||||||
|
{ id: 'Repair', name: 'В ремонте' },
|
||||||
|
{ id: 'Reserve', name: 'В резерве' },
|
||||||
|
{ id: 'WriteOff', name: 'Списано' },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const ChangeEquipmentStatusEdit = () => (
|
||||||
|
<Edit>
|
||||||
|
<SimpleForm>
|
||||||
|
<TextInput disabled source="id" label="Идентификатор" />
|
||||||
|
<ReferenceInput source="equipmentId" reference="equipment" label="Оборудование" />
|
||||||
|
<SelectInput
|
||||||
|
source="newStatus"
|
||||||
|
label="Новый статус"
|
||||||
|
choices={equipmentStatusChoices}
|
||||||
|
/>
|
||||||
|
<TextInput source="number" label="Номер" fullWidth />
|
||||||
|
<DateInput source="date" label="Дата изменения статуса" />
|
||||||
|
<TextInput source="responsible" label="Ответственный" fullWidth />
|
||||||
|
</SimpleForm>
|
||||||
|
</Edit>
|
||||||
|
);
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { List, DataTable, TextField, DateField, EditButton, ShowButton, ReferenceField } from 'react-admin';
|
||||||
|
import { EquipmentStatusField } from '../equipment/EquipmentStatusField';
|
||||||
|
|
||||||
|
export const ChangeEquipmentStatusList = () => (
|
||||||
|
<List>
|
||||||
|
<DataTable>
|
||||||
|
<DataTable.Col source="id" />
|
||||||
|
<DataTable.Col source="equipmentId" label="Оборудование">
|
||||||
|
<ReferenceField source="equipmentId" reference="equipment" />
|
||||||
|
</DataTable.Col>
|
||||||
|
<DataTable.Col source="newStatus" label="Новый статус" field={EquipmentStatusField} />
|
||||||
|
<DataTable.Col source="number" label="Номер" />
|
||||||
|
<DataTable.Col source="date" label="Дата изменения статуса" field={DateField} />
|
||||||
|
<DataTable.Col source="responsible" label="Ответственный" />
|
||||||
|
<DataTable.Col source="createdAt" label="Создано" field={DateField} />
|
||||||
|
<DataTable.Col source="updatedAt" label="Обновлено" field={DateField} />
|
||||||
|
<DataTable.Col>
|
||||||
|
<EditButton />
|
||||||
|
<ShowButton />
|
||||||
|
</DataTable.Col>
|
||||||
|
</DataTable>
|
||||||
|
</List>
|
||||||
|
);
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { Show, SimpleShowLayout, TextField, DateField, ReferenceField } from 'react-admin';
|
||||||
|
import { EquipmentStatusField } from '../equipment/EquipmentStatusField';
|
||||||
|
|
||||||
|
export const ChangeEquipmentStatusShow = () => (
|
||||||
|
<Show>
|
||||||
|
<SimpleShowLayout>
|
||||||
|
<TextField source="id" label="Идентификатор" />
|
||||||
|
<ReferenceField source="equipmentId" reference="equipment" label="Оборудование" />
|
||||||
|
<EquipmentStatusField source="newStatus" label="Новый статус" />
|
||||||
|
<TextField source="number" label="Номер" />
|
||||||
|
<DateField source="date" label="Дата изменения статуса" />
|
||||||
|
<TextField source="responsible" label="Ответственный" />
|
||||||
|
<DateField source="createdAt" label="Создано" />
|
||||||
|
<DateField source="updatedAt" label="Обновлено" />
|
||||||
|
</SimpleShowLayout>
|
||||||
|
</Show>
|
||||||
|
);
|
||||||
4
frontend/src/resources/change-equipment-status/index.ts
Normal file
4
frontend/src/resources/change-equipment-status/index.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export { ChangeEquipmentStatusList } from './ChangeEquipmentStatusList';
|
||||||
|
export { ChangeEquipmentStatusEdit } from './ChangeEquipmentStatusEdit';
|
||||||
|
export { ChangeEquipmentStatusCreate } from './ChangeEquipmentStatusCreate';
|
||||||
|
export { ChangeEquipmentStatusShow } from './ChangeEquipmentStatusShow';
|
||||||
25
frontend/src/resources/equipment/EquipmentCreate.tsx
Normal file
25
frontend/src/resources/equipment/EquipmentCreate.tsx
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { Create, SimpleForm, TextInput, DateInput, SelectInput } from 'react-admin';
|
||||||
|
|
||||||
|
const equipmentStatusChoices = [
|
||||||
|
{ id: 'Active', name: 'В эксплуатации' },
|
||||||
|
{ id: 'Repair', name: 'В ремонте' },
|
||||||
|
{ id: 'Reserve', name: 'В резерве' },
|
||||||
|
{ id: 'WriteOff', name: 'Списано' },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const EquipmentCreate = () => (
|
||||||
|
<Create>
|
||||||
|
<SimpleForm>
|
||||||
|
<TextInput source="name" label="Название" fullWidth required />
|
||||||
|
<TextInput source="serialNumber" label="Серийный номер" fullWidth required />
|
||||||
|
<DateInput source="dateOfInspection" label="Дата поверки" />
|
||||||
|
<DateInput source="commissionedAt" label="Дата изготовления" />
|
||||||
|
<SelectInput
|
||||||
|
source="status"
|
||||||
|
label="Статус"
|
||||||
|
choices={equipmentStatusChoices}
|
||||||
|
defaultValue="Active"
|
||||||
|
/>
|
||||||
|
</SimpleForm>
|
||||||
|
</Create>
|
||||||
|
);
|
||||||
25
frontend/src/resources/equipment/EquipmentEdit.tsx
Normal file
25
frontend/src/resources/equipment/EquipmentEdit.tsx
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { Edit, SimpleForm, TextInput, DateInput, SelectInput } from 'react-admin';
|
||||||
|
|
||||||
|
const equipmentStatusChoices = [
|
||||||
|
{ id: 'Active', name: 'В эксплуатации' },
|
||||||
|
{ id: 'Repair', name: 'В ремонте' },
|
||||||
|
{ id: 'Reserve', name: 'В резерве' },
|
||||||
|
{ id: 'WriteOff', name: 'Списано' },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const EquipmentEdit = () => (
|
||||||
|
<Edit>
|
||||||
|
<SimpleForm>
|
||||||
|
<TextInput disabled source="id" label="Идентификатор" />
|
||||||
|
<TextInput source="name" label="Название" fullWidth />
|
||||||
|
<TextInput source="serialNumber" label="Серийный номер" fullWidth />
|
||||||
|
<DateInput source="dateOfInspection" label="Дата поверки" />
|
||||||
|
<DateInput source="commissionedAt" label="Дата изготовления" />
|
||||||
|
<SelectInput
|
||||||
|
source="status"
|
||||||
|
label="Статус"
|
||||||
|
choices={equipmentStatusChoices}
|
||||||
|
/>
|
||||||
|
</SimpleForm>
|
||||||
|
</Edit>
|
||||||
|
);
|
||||||
21
frontend/src/resources/equipment/EquipmentList.tsx
Normal file
21
frontend/src/resources/equipment/EquipmentList.tsx
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { List, DataTable, TextField, DateField, EditButton, ShowButton } from 'react-admin';
|
||||||
|
import { EquipmentStatusField } from './EquipmentStatusField';
|
||||||
|
|
||||||
|
export const EquipmentList = () => (
|
||||||
|
<List>
|
||||||
|
<DataTable>
|
||||||
|
<DataTable.Col source="id" />
|
||||||
|
<DataTable.Col source="name" label="Название" />
|
||||||
|
<DataTable.Col source="serialNumber" label="Серийный номер" />
|
||||||
|
<DataTable.Col source="dateOfInspection" label="Дата поверки" field={DateField} />
|
||||||
|
<DataTable.Col source="commissionedAt" label="Дата изготовления" field={DateField} />
|
||||||
|
<DataTable.Col source="status" label="Статус" field={EquipmentStatusField} />
|
||||||
|
<DataTable.Col source="createdAt" label="Создано" field={DateField} />
|
||||||
|
<DataTable.Col source="updatedAt" label="Обновлено" field={DateField} />
|
||||||
|
<DataTable.Col>
|
||||||
|
<EditButton />
|
||||||
|
<ShowButton />
|
||||||
|
</DataTable.Col>
|
||||||
|
</DataTable>
|
||||||
|
</List>
|
||||||
|
);
|
||||||
17
frontend/src/resources/equipment/EquipmentShow.tsx
Normal file
17
frontend/src/resources/equipment/EquipmentShow.tsx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import { Show, SimpleShowLayout, TextField, DateField } from 'react-admin';
|
||||||
|
import { EquipmentStatusField } from './EquipmentStatusField';
|
||||||
|
|
||||||
|
export const EquipmentShow = () => (
|
||||||
|
<Show>
|
||||||
|
<SimpleShowLayout>
|
||||||
|
<TextField source="id" label="Идентификатор" />
|
||||||
|
<TextField source="name" label="Название" />
|
||||||
|
<TextField source="serialNumber" label="Серийный номер" />
|
||||||
|
<DateField source="dateOfInspection" label="Дата поверки" />
|
||||||
|
<DateField source="commissionedAt" label="Дата изготовления" />
|
||||||
|
<EquipmentStatusField source="status" label="Статус" />
|
||||||
|
<DateField source="createdAt" label="Создано" />
|
||||||
|
<DateField source="updatedAt" label="Обновлено" />
|
||||||
|
</SimpleShowLayout>
|
||||||
|
</Show>
|
||||||
|
);
|
||||||
15
frontend/src/resources/equipment/EquipmentStatusField.tsx
Normal file
15
frontend/src/resources/equipment/EquipmentStatusField.tsx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { useRecordContext } from 'react-admin';
|
||||||
|
|
||||||
|
const statusLabels: Record<string, string> = {
|
||||||
|
'Active': 'В эксплуатации',
|
||||||
|
'Repair': 'В ремонте',
|
||||||
|
'Reserve': 'В резерве',
|
||||||
|
'WriteOff': 'Списано',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const EquipmentStatusField = ({ source }: { source: string }) => {
|
||||||
|
const record = useRecordContext();
|
||||||
|
const status = record ? record[source] : null;
|
||||||
|
|
||||||
|
return <span>{status ? statusLabels[status] || status : ''}</span>;
|
||||||
|
};
|
||||||
4
frontend/src/resources/equipment/index.ts
Normal file
4
frontend/src/resources/equipment/index.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export { EquipmentList } from './EquipmentList';
|
||||||
|
export { EquipmentEdit } from './EquipmentEdit';
|
||||||
|
export { EquipmentCreate } from './EquipmentCreate';
|
||||||
|
export { EquipmentShow } from './EquipmentShow';
|
||||||
Reference in New Issue
Block a user