Skip to content

Commit

Permalink
feat: attachmentBox can work!
Browse files Browse the repository at this point in the history
  • Loading branch information
SolidZORO committed May 26, 2020
1 parent 66ecc1d commit 99c247a
Show file tree
Hide file tree
Showing 160 changed files with 1,333 additions and 1,172 deletions.
3 changes: 0 additions & 3 deletions packages/_leaa-common/src/dtos/_common/item.args.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
import { ArgsType } from '@nestjs/graphql';

@ArgsType()
export class ItemArgs {}
9 changes: 1 addition & 8 deletions packages/_leaa-common/src/dtos/_common/items.args.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
import { ArgsType, Field, Int } from '@nestjs/graphql';

export type IOrderSort = 'ASC' | 'DESC' | undefined;

@ArgsType()
export class ItemsArgs {
@Field(() => Int, { nullable: true, defaultValue: 1 })
page?: number = 1;

@Field(() => Int, { nullable: true, defaultValue: 30 })
pageSize?: number = 30;

@Field(() => String, { nullable: true, defaultValue: 'id' })
orderBy?: string = 'id';

@Field(() => String, { nullable: true, defaultValue: 'DESC' })
orderSort?: IOrderSort = 'DESC';

// q -> query -> keyword
@Field(() => String, { nullable: true })

q?: string;
}
8 changes: 0 additions & 8 deletions packages/_leaa-common/src/dtos/_common/pagination.object.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import { ObjectType, Field, Int } from '@nestjs/graphql';

@ObjectType()
export class PaginationObject {
@Field(() => Int, { nullable: true })
readonly page!: number;

@Field(() => Int)
readonly pageSize!: number;

@Field(() => Int, { nullable: true })
readonly nextPage?: number | null;

@Field(() => Int)
readonly itemsCount?: number;

@Field(() => Int)
readonly total!: number;
}
3 changes: 0 additions & 3 deletions packages/_leaa-common/src/dtos/action/action.args.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { ArgsType } from '@nestjs/graphql';

import { ItemArgs } from '@leaa/common/src/dtos/_common';

@ArgsType()
export class ActionArgs extends ItemArgs {}
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { ObjectType, Field } from '@nestjs/graphql';

import { Action } from '@leaa/common/src/entrys';
import { PaginationObject } from '@leaa/common/src/dtos/_common';

@ObjectType()
export class ActionsWithPaginationObject extends PaginationObject {
@Field(() => [Action])
readonly items: Action[] = [];
}
6 changes: 0 additions & 6 deletions packages/_leaa-common/src/dtos/action/actions.args.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import { ArgsType, Field } from '@nestjs/graphql';

import { ItemsArgs } from '@leaa/common/src/dtos/_common';

@ArgsType()
export class ActionsArgs extends ItemsArgs {
@Field(() => String, { nullable: true })
tagName?: string;

@Field(() => String, { nullable: true })
categoryName?: string;

@Field(() => String, { nullable: true })
categoryId?: string;
}
9 changes: 0 additions & 9 deletions packages/_leaa-common/src/dtos/action/create-action.input.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
import { IsNotEmpty, IsOptional } from 'class-validator';
import { Field, InputType } from '@nestjs/graphql';

@InputType()
export class CreateActionInput {
@IsNotEmpty()
@Field(() => String, { nullable: true })
ip?: string;

@IsNotEmpty()
@Field(() => String)
module!: string;

@IsOptional()
@Field(() => String)
action?: string;

@IsOptional()
@Field(() => String, { nullable: true })
account?: string;

@IsOptional()
@Field(() => String, { nullable: true })
token?: string;

@IsOptional()
@Field(() => String, { nullable: true })
user_id?: string;

@IsOptional()
@Field(() => String, { nullable: true })
diff?: string;
}
5 changes: 0 additions & 5 deletions packages/_leaa-common/src/dtos/action/update-action.input.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import { IsOptional } from 'class-validator';
import { Field, InputType } from '@nestjs/graphql';

@InputType()
export class UpdateActionInput {
@IsOptional()
@Field(() => String, { nullable: true })
account?: string;

@IsOptional()
@Field(() => String, { nullable: true })
user_id?: string;

@IsOptional()
@Field(() => String, { nullable: true })
diff?: string;
}
3 changes: 0 additions & 3 deletions packages/_leaa-common/src/dtos/address/address.args.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { ArgsType } from '@nestjs/graphql';

import { ItemArgs } from '@leaa/common/src/dtos/_common';

@ArgsType()
export class AddressArgs extends ItemArgs {}
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { ObjectType, Field } from '@nestjs/graphql';

import { Address } from '@leaa/common/src/entrys';
import { PaginationObject } from '@leaa/common/src/dtos/_common';

@ObjectType()
export class AddressesWithPaginationObject extends PaginationObject {
@Field(() => [Address])
readonly items: Address[] = [];
}
3 changes: 0 additions & 3 deletions packages/_leaa-common/src/dtos/address/addresses.args.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { ArgsType } from '@nestjs/graphql';

import { ItemsArgs } from '@leaa/common/src/dtos/_common';

@ArgsType()
export class AddressesArgs extends ItemsArgs {}
10 changes: 0 additions & 10 deletions packages/_leaa-common/src/dtos/address/create-address.input.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
import { IsNotEmpty, IsOptional } from 'class-validator';
import { Field, InputType, Int } from '@nestjs/graphql';

@InputType()
export class CreateAddressInput {
@IsNotEmpty()
@Field(() => String)
address!: string;

@IsNotEmpty()
@Field(() => String)
province!: string;

@IsNotEmpty()
@Field(() => String)
city!: string;

@IsOptional()
@Field(() => String, { nullable: true })
area?: string;

@IsOptional()
@Field(() => String, { nullable: true })
consignee!: string;

@IsOptional()
@Field(() => Int, { nullable: true })
zip?: number;

@IsOptional()
@Field(() => String, { nullable: true })
phone?: string;

@IsOptional()
@Field(() => Int, { nullable: true })
status?: number;
}
10 changes: 0 additions & 10 deletions packages/_leaa-common/src/dtos/address/update-address.input.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
import { IsOptional } from 'class-validator';
import { Field, InputType, Int } from '@nestjs/graphql';

@InputType()
export class UpdateAddressInput {
@IsOptional()
@Field(() => String, { nullable: true })
address?: string;

@IsOptional()
@Field(() => String, { nullable: true })
province?: string;

@IsOptional()
@Field(() => String, { nullable: true })
city?: string;

@IsOptional()
@Field(() => String, { nullable: true })
area?: string;

@IsOptional()
@Field(() => String, { nullable: true })
consignee?: string;

@IsOptional()
@Field(() => Int, { nullable: true })
zip?: number;

@IsOptional()
@Field(() => String, { nullable: true })
phone?: string;

@IsOptional()
@Field(() => Int, { nullable: true })
status?: number;
}
3 changes: 0 additions & 3 deletions packages/_leaa-common/src/dtos/article/article.args.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { ArgsType } from '@nestjs/graphql';

import { ItemArgs } from '@leaa/common/src/dtos/_common';

@ArgsType()
export class ArticleArgs extends ItemArgs {}
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { ObjectType, Field } from '@nestjs/graphql';

import { Article } from '@leaa/common/src/entrys';
import { PaginationObject } from '@leaa/common/src/dtos/_common';

@ObjectType()
export class ArticlesWithPaginationObject extends PaginationObject {
@Field(() => [Article])
readonly items: Article[] = [];
}
6 changes: 0 additions & 6 deletions packages/_leaa-common/src/dtos/article/articles.args.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import { ArgsType, Field, Int } from '@nestjs/graphql';

import { ItemsArgs } from '@leaa/common/src/dtos/_common';

@ArgsType()
export class ArticlesArgs extends ItemsArgs {
@Field(() => String, { nullable: true })
tagName?: string;

@Field(() => String, { nullable: true })
categoryName?: string;

@Field(() => String, { nullable: true })
categoryId?: string;
}
3 changes: 0 additions & 3 deletions packages/_leaa-common/src/dtos/attachment/attachment.args.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { ArgsType } from '@nestjs/graphql';

import { ItemArgs } from '@leaa/common/src/dtos/_common';

@ArgsType()
export class AttachmentArgs extends ItemArgs {}
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { ObjectType, Field } from '@nestjs/graphql';

import { Attachment } from '@leaa/common/src/entrys';
import { PaginationObject } from '@leaa/common/src/dtos/_common';

@ObjectType()
export class AttachmentsWithPaginationObject extends PaginationObject {
@Field(() => [Attachment])
readonly items: Attachment[] = [];
}
10 changes: 0 additions & 10 deletions packages/_leaa-common/src/dtos/attachment/attachments.args.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,29 @@
import { IsOptional } from 'class-validator';
import { ArgsType, Field, Int } from '@nestjs/graphql';

import { ItemsArgs } from '@leaa/common/src/dtos/_common';

@ArgsType()
export class AttachmentsArgs extends ItemsArgs {
@IsOptional()
@Field(() => String, { nullable: true })
type?: string;

@IsOptional()
@Field(() => String, { nullable: true })
moduleName?: string;

@IsOptional()
@Field(() => String, { nullable: true })
moduleId?: string;

@IsOptional()
@Field(() => String, { nullable: true })
typeName?: string;

@IsOptional()
@Field(() => String, { nullable: true })
typePlatform?: string;

@IsOptional()
@Field(() => String, { nullable: true })
categoryId?: string;

@IsOptional()
@Field(() => String, { nullable: true })
userId?: string;

@IsOptional()
@Field(() => Int, { nullable: true })
refreshHash?: number;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { ObjectType, Field } from '@nestjs/graphql';

import { Attachment } from '@leaa/common/src/entrys';

@ObjectType()
export class AttachmentsObject {
@Field(() => [Attachment])
readonly items: Attachment[] = [];
}

0 comments on commit 99c247a

Please sign in to comment.