Skip to content

Commit

Permalink
fix: conflict when rework old commits
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Nguyen <[email protected]>
  • Loading branch information
vanpho93 committed May 19, 2023
1 parent 36dfccd commit 4233f57
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 234 deletions.
7 changes: 0 additions & 7 deletions .changeset/curly-clocks-notice.md

This file was deleted.

11 changes: 3 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ jobs:
- run:
name: Check should build new image
command: |
head_commit=$(git log -1 --oneline | grep -m 1 releases)
if [[ $head_commit != *"/releases/docker-image"* ]]; then
VERSION=$(cat ./apps/reaction/package.json | grep -m 1 version | sed 's/[^0-9.]//g')
if curl --silent -f --head -lL https://hub.docker.com/v2/repositories/${DOCKER_REPOSITORY}/tags/${VERSION}/ > /dev/null; then
circleci-agent step halt
fi
- run:
Expand Down Expand Up @@ -267,9 +267,4 @@ workflows:
only:
- trunk
requires:
- dockerfile-lint
- eslint
- graphql-lint
- test-unit
- test-integration-query
- test-integration-mutation
- release
60 changes: 0 additions & 60 deletions .github/workflows/docker-release.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,7 @@ yalc-packages

# Build
dist

# Editor
.vscode
.idea
6 changes: 6 additions & 0 deletions apps/reaction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
"@reactioncommerce/api-plugin-payments-stripe-sca": "1.0.2",
"@reactioncommerce/api-plugin-pricing-simple": "1.0.7",
"@reactioncommerce/api-plugin-products": "1.3.1",
"@reactioncommerce/api-plugin-promotions": "0.0.0",
"@reactioncommerce/api-plugin-promotions-coupons": "0.0.0",
"@reactioncommerce/api-plugin-promotions-discounts": "0.0.0",
"@reactioncommerce/api-plugin-promotions-offers": ".0.0",
"@reactioncommerce/api-plugin-sequences": "0.0.0",
"@reactioncommerce/api-plugin-settings": "1.0.7",
"@reactioncommerce/api-plugin-shipments": "1.0.3",
"@reactioncommerce/api-plugin-shipments-flat-rate": "1.0.10",
Expand All @@ -67,6 +72,7 @@
"@reactioncommerce/logger": "1.1.5",
"@reactioncommerce/random": "1.0.2",
"@snyk/protect": "latest",
"nodemailer": "^6.8.0",
"graphql": "~16.6.0",
"semver": "~6.3.0",
"sharp": "^0.30.7"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.4"

services:
mongo:
image: mongo:4.2.0
image: mongo:5.0
command: mongod --oplogSize 128 --replSet rs0 --storageEngine=wiredTiger
networks:
default:
Expand Down
15 changes: 15 additions & 0 deletions packages/api-plugin-carts/src/schemas/cart.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,21 @@ input CartUpdatedInput {
cartToken: String
}

"Input for the `acknowledgeCartMessage` mutation call"
input AcknowledgeCartMessageInput {
"The cart ID"
cartId: ID!,

"The message to acknowledge"
messageId: String!

"An optional string identifying the mutation call, which will be returned in the response payload"
clientMutationId: String

"The cart anonymous token"
cartToken: String
}

####################
# Payloads
# These types are used as return values for mutation calls
Expand Down
11 changes: 11 additions & 0 deletions packages/api-plugin-promotions/src/mutations/createPromotion.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ import validateTriggerParams from "./validateTriggerParams.js";
export default async function createPromotion(context, promotion) {
const { collections: { Promotions }, simpleSchemas: { Promotion: PromotionSchema }, promotions } = context;
promotion._id = Random.id();
const now = new Date();
if (promotion.triggers && promotion.triggers.length) { // if there are no triggers, this is an error, but we'll let schema validation catch it
const [firstTrigger] = promotion.triggers; // currently support only one trigger
const { triggerKey } = firstTrigger;
const trigger = promotions.triggers.find((tr) => tr.key === triggerKey);
if (!trigger) throw new ReactionError("invalid-params", `No trigger found with key ${triggerKey}`);
promotion.triggerType = trigger.type;
}
promotion.state = "created";
promotion.createdAt = now;
promotion.updatedAt = now;
promotion.referenceId = await context.mutations.incrementSequence(context, promotion.shopId, "Promotions");

PromotionSchema.validate(promotion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,46 +34,7 @@ const insertResults = {
insertedId: "myId"
};
mockContext.collections.Promotions.insertOne = () => insertResults;
mockContext.mutations.incrementSequence = () => 1;

const now = new Date();

const OrderPromotion = {
_id: "orderPromotion",
shopId: "testShop",
promotionType: "coupon",
label: "5 percent off your entire order when you spend more then $200",
description: "5 percent off your entire order when you spend more then $200",
enabled: true,
triggers: [
{
triggerKey: "offers",
triggerParameters: {
name: "5 percent off your entire order when you spend more then $200",
conditions: {
any: [
{
fact: "cart",
path: "$.merchandiseTotal",
operator: "greaterThanInclusive",
value: 200
}
]
}
}
}
],
actions: [
{
actionKey: "noop",
actionParameters: {}
}
],
startDate: now,
endDate: new Date(now.getTime() + 1000 * 60 * 60 * 24 * 7),
stackAbility: "none"
};

mockContext.mutations.incrementSequence = () => 1000000;
mockContext.simpleSchemas = {
Promotion
};
Expand Down
4 changes: 4 additions & 0 deletions packages/api-plugin-promotions/src/simpleSchemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export const Promotion = new SimpleSchema({
type: String,
allowedValues: ["implicit", "explicit"]
},
"promotionType": {
type: String, // this is the key to the promotion type object
allowedValues: promotionTypeKeys
},
"referenceId": {
type: SimpleSchema.Integer
},
Expand Down
5 changes: 2 additions & 3 deletions packages/api-plugin-sample-data/src/loaders/loadImages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/* eslint-disable no-await-in-loop */
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import { Readable } from "stream";
import pkg from "@reactioncommerce/file-collections";

Expand Down Expand Up @@ -107,8 +106,8 @@ export default async function loadImages(context, shopId) {

const topProdIds = [];
const fileType = "image/jpeg";
const currentDir = path.dirname(fileURLToPath(import.meta.url));
const folderPath = path.join(currentDir, "../images/");
const folderPath = "../../packages/api-plugin-sample-data/src/images/";

let fileList = [];
try {
fileList = fs.readdirSync(folderPath);
Expand Down
2 changes: 1 addition & 1 deletion packages/file-collections-sa-gridfs/src/GridFSStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class GridFSStore extends StorageAdapter {
// Add range if this should be a partial read
if (typeof startPos === "number" && typeof endPos === "number") {
opts.start = startPos;
opts.end = endPos + 1;
opts.end = endPos;
}

debug("GridFSStore _getReadStream opts:", opts);
Expand Down
3 changes: 0 additions & 3 deletions packages/file-collections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@
"main": "./dist/node/index.js",
"scripts": {
"build": "rm -rf dist/** && babel src --out-dir dist --ignore \"**/*.test.js\"",
"test": "jest",
"test:watch": "jest --watch",
"test:file": "jest --no-cache --watch --coverage=false",
"prepublishOnly": "npm run build"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function requestRange(headers, fileSize) {
if (String(startByte) !== start) startByte = 0;
if ((String(endByte) !== end) || endByte === 0) endByte = fileSize - 1;

if (startByte >= endByte || endByte >= fileSize) {
if (start >= end) {
return {
errorCode: 416,
errorMessage: "Requested Range Not Satisfiable"
Expand All @@ -68,11 +68,11 @@ export default function requestRange(headers, fileSize) {

const partSize = (endByte - startByte) + 1;
return {
end: endByte,
end,
len: partSize,
partial: (partSize < fileSize),
size: fileSize,
start: startByte,
start,
unit
};
}

This file was deleted.

Loading

0 comments on commit 4233f57

Please sign in to comment.