Revert "Add publishing date (#107)" (#108)

This commit is contained in:
Anders Gustafsson
2022-03-11 09:19:07 +01:00
committed by GitHub
parent cf6b1fd56e
commit b1da0b547e
8 changed files with 4051 additions and 4166 deletions
-1
View File
@@ -8,7 +8,6 @@ COPY . app/
WORKDIR /app
# Set node env
ENV NODE_ENV=production
ENV NEW_RELIC_NO_CONFIG_FILE=true
# Installs npm dependencies on container
RUN npm ci
# Command container will actually run when called
+3786 -3816
View File
File diff suppressed because it is too large Load Diff
-37
View File
@@ -155,7 +155,6 @@ export class ProductAPI extends BaseSQLDataSource {
}
createProductFromRow(row: any) {
row.publishingDate = row.publishing_date;
row.blacklisting = this.getBlacklisting(row);
row.printProducts = this.getPrintProducts(row);
row.type = this.getProductTypes(row);
@@ -431,15 +430,6 @@ export class ProductAPI extends BaseSQLDataSource {
promises.push(promise);
}
const pd = info.publishingDate;
const publishingDate = new Date(
pd.getFullYear(),
pd.getMonth(),
pd.getDate(),
0,
0,
0,
);
promises.push(
this.knex
.table('product-products')
@@ -448,7 +438,6 @@ export class ProductAPI extends BaseSQLDataSource {
browsable: info.browsable ? 1 : 0,
visible: info.visible ? 1 : 0,
designerid: info.designerId ?? null,
publishingDate: publishingDate,
ref1: info.ref1,
ref2: info.ref2,
ref3: info.ref3,
@@ -478,32 +467,6 @@ export class ProductAPI extends BaseSQLDataSource {
return Promise.all(promises);
}
/**
* @function productPublishing
* @description updates a products publishing
*/
async productPublishing(productId: number, date: Date) {
return this.knex
.table('product-products')
.update({
publishing_date: date,
})
.where('productid', productId);
}
/**
* @function massUpdatePublishingDate
* @description Mass update publishing date
*/
async massUpdatePublishingDate(productIds: Array<number>, date: Date) {
return this.knex
.table('product-products')
.update({
publishing_date: date,
})
.whereIn('productid', productIds);
}
/**
* @function massUpdatePublishing
* @description Mass update visible and browsable
+1 -2
View File
@@ -12,7 +12,6 @@ SELECT products.productid AS id,
products.designerid,
products.inserted,
products.updated,
products.publishing_date,
products.ref1,
products.ref2,
products.ref3,
@@ -90,7 +89,7 @@ export function products(input: ProductsFilterInput) {
AND products.browsable = ${filter?.browsable ? '1' : '0'}`
: ``
}
ORDER BY products.publishing_date DESC
ORDER BY products.inserted DESC
LIMIT ${limit} OFFSET ${offset}
`
);
+1 -11
View File
@@ -1,4 +1,4 @@
const newrelic = require('newrelic');
require('newrelic');
import dotenv from 'dotenv';
dotenv.config();
@@ -90,7 +90,6 @@ const context = async ({ req }) => {
};
async function main() {
try {
const server = new ApolloServer({
typeDefs,
resolvers,
@@ -98,11 +97,6 @@ async function main() {
context,
introspection: true,
plugins: [newRelicPlugin],
formatError: (err) => {
console.log('Error (fmt):', err);
newrelic.noticeError(err);
return err;
},
});
await server.listen();
@@ -111,9 +105,5 @@ async function main() {
'Server is running on http://localhost:4000, ',
process.env.ENVIRONMENT_NAME,
);
} catch (ex) {
newrelic.noticeError(ex);
console.error('Got terminal exception:', ex);
}
}
main();
-18
View File
@@ -476,22 +476,4 @@ export const productMutationTypeDefs = {
value: 'OK',
};
},
/**
* @function massUpdatePublishing
* @description Mutate the Publishing for products
*/
async massUpdatePublishingDate(
_,
{ productIds, date },
{ dataSources, auth },
) {
checkAccess(['products.write'], auth);
await (<ProductAPI>dataSources.productApi).massUpdatePublishingDate(
productIds,
date,
);
return {
value: 'OK',
};
},
};
+10 -27
View File
@@ -236,7 +236,6 @@ type Product {
browsable: Boolean!
inserted: DateTime!
updated: DateTime
publishingDate: DateTime!
printProducts: [PrintProduct]
blacklisting: [ProductBlacklist]
categories: [Category]
@@ -406,7 +405,6 @@ input ProductInfoInput {
designerId: Int
browsable: Boolean!
visible: Boolean!
publishingDate: DateTime!
printFileWidth: Int!
printFileHeight: Int!
printFileDpi: Int!
@@ -437,9 +435,8 @@ type IdNumberResult {
}
type Mutation {
"""
Product
"""
""" Product """
addProduct(name: String!, batch: String): Product
productInfo(productId: Int!, info: ProductInfoInput!): Product
productWallpaperType(
@@ -450,9 +447,8 @@ type Mutation {
productId: Int!
markets: [ProductBlacklistingInput]
): Product
"""
Product Image
"""
""" Product Image """
productFocusPoint(
productId: Int!
focusXpoint2: Float!
@@ -469,32 +465,22 @@ type Mutation {
height: Int!
): String
"""
Product Relations
"""
""" Product Relations """
addRelatedProducts(productId: Int!, articleNumbers: [String]!): Product
removeRelatedProducts(productId: Int!, relatedProductIds: [Int]!): Product
"""
Product Categories
"""
""" Product Categories """
addCategoriesToProduct(productId: Int!, categoryIds: [Int]!): Product
removeCategoriesFromProduct(productId: Int!, categoryIds: [Int]!): Product
"""
Product Keywords
"""
""" Product Keywords """
productKeywords(productId: Int!, keywordIds: [Int]): Product
addKeyword(name: String!, type: KeywordType): Keyword
"""
Product Other
"""
""" Product Other """
updateProductComments(productId: Int!, comments: String!): Product
"""
Printproducts
"""
""" Printproducts """
productGroup(productId: Int!, groupIds: [Int]): Product
productGroupInteriors(productId: Int!, groupId: Int!, uris: [String]): Product
addOwnInteriorToPrintProduct(
@@ -510,9 +496,7 @@ type Mutation {
border: BorderType!
): PrintProductDefaults
"""
Mass Update
"""
""" Mass Update """
massUpdatePublishing(
productIds: [Int]!
visible: Boolean
@@ -522,5 +506,4 @@ type Mutation {
productIds: [Int]!
markets: [ProductBlacklistingInput]
): StringResult
massUpdatePublishingDate(productIds: [Int]!, date: DateTime!): StringResult
}
-1
View File
@@ -16,7 +16,6 @@ export interface ProductInfoInput {
designerId: Maybe<number>;
browsable: boolean;
visible: boolean;
publishingDate: Date;
printFileWidth: number;
printFileHeight: number;
printFileDpi: number;