Skip to content
This repository was archived by the owner on Nov 21, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/__tests__/productMutations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('Test products mutations', () => {
$categoryId: String,
$sku: String
$code: String
$attachment: AttachmentInput
`;

const commonParams = `
Expand All @@ -25,6 +26,7 @@ describe('Test products mutations', () => {
categoryId: $categoryId
sku: $sku
code: $code
attachment: $attachment
`;

const commonCategoryParamDefs = `
Expand Down Expand Up @@ -77,6 +79,12 @@ describe('Test products mutations', () => {
description
sku
code
attachment {
url
name
type
size
}
}
}
`;
Expand Down Expand Up @@ -112,6 +120,12 @@ describe('Test products mutations', () => {
description
sku
code
attachment {
url
name
type
size
}
}
}
`;
Expand Down
6 changes: 6 additions & 0 deletions src/__tests__/productQueries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ describe('productQueries', () => {
description
sku
createdAt
attachment {
name
url
type
size
}
}
}
`;
Expand Down
6 changes: 4 additions & 2 deletions src/data/schema/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const types = `
parentId: String
code: String!
order: String!

isRoot: Boolean
productCount: Int
}
Expand All @@ -24,6 +24,7 @@ export const types = `
createdAt: Date
getTags: [Tag]
tagIds: [String]
attachment: Attachment

category: ProductCategory
}
Expand All @@ -37,7 +38,8 @@ const productParams = `
sku: String,
unitPrice: Float,
code: String,
customFieldsData: JSON
customFieldsData: JSON,
attachment: AttachmentInput
`;

const productCategoryParams = `
Expand Down
4 changes: 3 additions & 1 deletion src/db/models/definitions/deals.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Document, Schema } from 'mongoose';
import { commonItemFieldsSchema, IItemCommonFields } from './boards';
import { attachmentSchema, commonItemFieldsSchema, IItemCommonFields } from './boards';
import { customFieldSchema, ICustomField } from './common';
import { PRODUCT_TYPES } from './constants';
import { field, schemaWrapper } from './utils';
Expand All @@ -16,6 +16,7 @@ export interface IProduct {
customFieldsData?: ICustomField[];
productId?: string;
tagIds?: string[];
attachment?: any;
}

export interface IProductDocument extends IProduct, Document {
Expand Down Expand Up @@ -91,6 +92,7 @@ export const productSchema = schemaWrapper(
default: new Date(),
label: 'Created at',
}),
attachment: field({ type: attachmentSchema, label: 'Attachments' }),
}),
);

Expand Down