fix: merge conflicts

This commit is contained in:
Sebastian Rindom
2021-10-18 15:11:40 +02:00
5 changed files with 35 additions and 19 deletions

View File

@@ -4,26 +4,40 @@
/packages/medusa/src/services/claim-item.js
/packages/medusa/src/services/event-bus.js
/packages/medusa/src/services/fulfillment-provider.js
<<<<<<< HEAD
/packages/medusa/src/services/idempotency-key.js
/packages/medusa/src/services/inventory.js
/packages/medusa/src/services/middleware.js
/packages/medusa/src/services/note.js
=======
/packages/medusa/src/services/inventory.js
/packages/medusa/src/services/middleware.js
>>>>>>> origin/feat/meilisearch-plugin
/packages/medusa/src/services/oauth.js
/packages/medusa/src/services/payment-provider.js
/packages/medusa/src/services/product-collection.js
/packages/medusa/src/services/product-variant.js
/packages/medusa/src/services/product.js
<<<<<<< HEAD
/packages/medusa/src/services/query-builder.js
=======
>>>>>>> origin/feat/meilisearch-plugin
/packages/medusa/src/services/return.js
/packages/medusa/src/services/shipping-profile.js
/packages/medusa/src/services/store.js
/packages/medusa/src/services/swap.js
<<<<<<< HEAD
/packages/medusa/src/services/system-payment-provider.js
=======
>>>>>>> origin/feat/meilisearch-plugin
/packages/medusa/src/services/totals.js
/packages/medusa/src/subscribers/notification.js
/packages/medusa/src/subscribers/order.js
<<<<<<< HEAD
/packages/medusa/src/subscribers/product.js
=======
>>>>>>> origin/feat/meilisearch-plugin
/packages/medusa/src/loaders/api.js
/packages/medusa/src/loaders/database.js

View File

@@ -1,7 +1,6 @@
import { BaseService } from "medusa-interfaces"
import { MedusaError } from "medusa-core-utils"
import { v4 } from "uuid"
import IdempotencyKeyModel from "../models/idempotency-key"
const KEY_LOCKED_TIMEOUT = 1000
@@ -28,7 +27,7 @@ class IdempotencyKeyService extends BaseService {
* @return {Promise<IdempotencyKeyModel>} the existing or created idempotency key
*/
async initializeRequest(headerKey, reqMethod, reqParams, reqPath) {
return this.atomicPhase_(async _ => {
return this.atomicPhase_(async (_) => {
// If idempotency key exists, return it
let key = await this.retrieve(headerKey)
@@ -54,7 +53,7 @@ class IdempotencyKeyService extends BaseService {
* @return {Promise<IdempotencyKeyModel>} the created idempotency key
*/
async create(payload) {
return this.atomicPhase_(async manager => {
return this.atomicPhase_(async (manager) => {
const idempotencyKeyRepo = manager.getCustomRepository(
this.idempotencyKeyRepository_
)
@@ -93,7 +92,7 @@ class IdempotencyKeyService extends BaseService {
* @return {Promise} result of the update operation
*/
async lock(idempotencyKey) {
return this.atomicPhase_(async manager => {
return this.atomicPhase_(async (manager) => {
const idempotencyKeyRepo = manager.getCustomRepository(
this.idempotencyKeyRepository_
)
@@ -120,7 +119,7 @@ class IdempotencyKeyService extends BaseService {
* @return {Promise} result of the update operation
*/
async update(idempotencyKey, update) {
return this.atomicPhase_(async manager => {
return this.atomicPhase_(async (manager) => {
const idempotencyKeyRepo = manager.getCustomRepository(
this.idempotencyKeyRepository_
)
@@ -148,7 +147,7 @@ class IdempotencyKeyService extends BaseService {
*/
async workStage(idempotencyKey, func) {
try {
return await this.atomicPhase_(async manager => {
return await this.atomicPhase_(async (manager) => {
let key
const { recovery_point, response_code, response_body } = await func(

View File

@@ -1,6 +1,5 @@
import { MedusaError } from "medusa-core-utils"
import { BaseService } from "medusa-interfaces"
import _ from "lodash"
import { TransactionManager } from "typeorm"
class NoteService extends BaseService {
@@ -47,7 +46,7 @@ class NoteService extends BaseService {
* Retrieves a specific note.
* @param {*} id - the id of the note to retrieve.
* @param {*} config - any options needed to query for the result.
* @returns {Promise} which resolves to the requested note.
* @return {Promise} which resolves to the requested note.
*/
async retrieve(id, config = {}) {
const noteRepo = this.manager_.getCustomRepository(this.noteRepository_)
@@ -91,14 +90,14 @@ class NoteService extends BaseService {
* Creates a note associated with a given author
* @param {object} data - the note to create
* @param {*} config - any configurations if needed, including meta data
* @returns {Promise} resolves to the creation result
* @return {Promise} resolves to the creation result
*/
async create(data, config = { metadata: {} }) {
const { metadata } = config
const { resource_id, resource_type, value, author_id } = data
return this.atomicPhase_(async manager => {
return this.atomicPhase_(async (manager) => {
const noteRepo = manager.getCustomRepository(this.noteRepository_)
const toCreate = {
@@ -124,10 +123,10 @@ class NoteService extends BaseService {
* Updates a given note with a new value
* @param {*} noteId - the id of the note to update
* @param {*} value - the new value
* @returns {Promise} resolves to the updated element
* @return {Promise} resolves to the updated element
*/
async update(noteId, value) {
return this.atomicPhase_(async manager => {
return this.atomicPhase_(async (manager) => {
const noteRepo = manager.getCustomRepository(this.noteRepository_)
const note = await this.retrieve(noteId, { relations: ["author"] })
@@ -147,10 +146,10 @@ class NoteService extends BaseService {
/**
* Deletes a given note
* @param {*} noteId - id of the note to delete
* @returns {Promise}
* @return {Promise}
*/
async delete(noteId) {
return this.atomicPhase_(async manager => {
return this.atomicPhase_(async (manager) => {
const noteRepo = manager.getCustomRepository(this.noteRepository_)
const note = await this.retrieve(noteId)

View File

@@ -23,11 +23,13 @@ class QueryBuilderService extends BaseService {
}
buildFilterQuery(filters) {
if (_.isEmpty(filters)) return
if (_.isEmpty(filters)) {
return
}
const filterQuery = {}
Object.keys(filters).map(filter => {
Object.keys(filters).map((filter) => {
filterQuery[filter] = filters[filter]
})
@@ -35,9 +37,11 @@ class QueryBuilderService extends BaseService {
}
buildTextSearchQuery(search, searchProperties) {
if (_.isEmpty(search)) return
if (_.isEmpty(search)) {
return
}
const searchQuery = searchProperties.map(s => ({
const searchQuery = searchProperties.map((s) => ({
[s]: new RegExp(search.q, "i"),
}))

View File

@@ -3,7 +3,7 @@ import { BaseService } from "medusa-interfaces"
class SystemProviderService extends BaseService {
static identifier = "system"
constructor({}) {
constructor(_) {
super()
}