0.0.49 • Published 1 year ago
@flippico/crud-layer v0.0.49
Require install
yarn add @jenyus-org/nestjs-graphql-utils apollo-server-core nestjs-typeorm-paginate
// App module
@Module({
imports: [
CrudLayerModule,
]
// ...
});
// Attachments
@ObjectType()
export class Attachments {
@Field(() => ID)
id?: string;
@Field({ nullable: true })
name: string;
}
@InputType()
export class AttachmentsMutation {
@Field({ nullable: true })
name: string;
}
// Attachments input dto
import { ID, InputType } from '@nestjs/graphql';
import { FilterableField } from '@flippico/crud-layer';
@InputType('AttachmentsInput')
export class AttachmentsInputDto {
@FilterableField(() => ID, { nullable: true })
id?: string;
@FilterableField(() => Date, { nullable: true })
createdAt?: Date;
@FilterableField(() => Date, { nullable: true })
updatedAt?: Date;
}
// Attachments service
import { Injectable } from '@nestjs/common';
import { AttachmentsEntity } from './entities/attachments.entity';
import { baseServiceGenerator } from '@flippico/crud-layer';
@Injectable()
export class AttachmentsService extends baseServiceGenerator(
AttachmentsEntity,
{
create: [],
update: [],
remove: [],
},
) {}
// Attachments resolver
import { ArgsType, Resolver } from '@nestjs/graphql';
import { findAllArgsGenerator } from '@flippico/crud-layer';
import { AttachmentsInputDto } from './dto/attachments-input.dto';
import { AttachmentsService } from './attachments.service';
@ArgsType()
export class AttachmentsFindAllFnArgs extends findAllArgsGenerator(AttachmentsInputDto) {}
@Resolver()
export class AttachmentsResolver {
constructor(private conversationChannelService: AttachmentsService) {}
}
// Feature module
@Module({
imports: [
CrudLayerModule.forFeature({
dto: Attachments,
inputDto: AttachmentsInputDto,
mutationDto: AttachmentsMutation,
typeOrmModule: [AttachmentsEntity],
}),
TypeOrmModule.forFeature([AttachmentsEntity]), // Enittty
],
providers: [AttachmentsService, AttachmentsResolver],
// ...
});
0.0.49
1 year ago
0.0.48
1 year ago
0.0.47
1 year ago
0.0.43
1 year ago
0.0.44
1 year ago
0.0.45
1 year ago
0.0.46
1 year ago
0.0.41
1 year ago
0.0.42
1 year ago
0.0.40
1 year ago
0.0.38
1 year ago
0.0.39
1 year ago
0.0.37
2 years ago
0.0.36
2 years ago
0.0.31
2 years ago
0.0.32
2 years ago
0.0.33
2 years ago
0.0.34
2 years ago
0.0.35
2 years ago
0.0.30
2 years ago
0.0.28
2 years ago
0.0.29
2 years ago
0.0.27
2 years ago
0.0.26
2 years ago
0.0.25
2 years ago
0.0.23
2 years ago
0.0.20
2 years ago
0.0.21
2 years ago
0.0.22
2 years ago
0.0.18
2 years ago
0.0.19
2 years ago
0.0.10
2 years ago
0.0.11
2 years ago
0.0.12
2 years ago
0.0.13
2 years ago
0.0.14
2 years ago
0.0.15
2 years ago
0.0.9
2 years ago
0.0.16
2 years ago
0.0.8
2 years ago
0.0.17
2 years ago
0.0.5
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago