feat(workflows-sdk,core-flows,medusa,types): add workflow to update promotions to cart (#6474)

what:

- adds API + workflow to add/remove promotions in a cart
- minor fixes in promotions module
- minor type fixes in cart module
- typing fix in workflows-sdk (Thanks @adrien2p)
- fix step result in workflows-sdk (Thanks @adrien2p)

RESOLVES CORE-1768

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
This commit is contained in:
Riqwan Thamir
2024-02-26 12:43:57 +00:00
committed by GitHub
co-authored by Adrien de Peretti
parent 63be07031b
commit ac86362e81
30 changed files with 1187 additions and 101 deletions
@@ -12,11 +12,11 @@ import {
SoftDeleteReturn,
} from "@medusajs/types"
import {
MapToConfig,
isString,
kebabCase,
lowerCaseFirst,
mapObjectTo,
MapToConfig,
pluralize,
upperCaseFirst,
} from "../common"
@@ -311,9 +311,8 @@ export function abstractModuleServiceFactory<
config: FindConfig<any> = {},
sharedContext: Context = {}
): Promise<T[]> {
const entities = await this.__container__[
serviceRegistrationName
].list(filters, config, sharedContext)
const service = this.__container__[serviceRegistrationName]
const entities = await service.list(filters, config, sharedContext)
return await this.baseRepository_.serialize<T[]>(entities, {
populate: true,
@@ -6,10 +6,10 @@ import {
ModuleServiceInitializeOptions,
RepositoryService,
} from "@medusajs/types"
import { lowerCaseFirst } from "../../common"
import { asClass } from "awilix"
import { internalModuleServiceFactory } from "../internal-module-service-factory"
import { lowerCaseFirst } from "../../common"
import { mikroOrmBaseRepositoryFactory } from "../../dal"
import { internalModuleServiceFactory } from "../internal-module-service-factory"
type RepositoryLoaderOptions = {
moduleModels: Record<string, any>
@@ -96,7 +96,10 @@ export function loadModuleServices({
const finalService = moduleServicesMap.get(mappedServiceName)
if (!finalService) {
moduleServicesMap.set(mappedServiceName, internalModuleServiceFactory(Model))
moduleServicesMap.set(
mappedServiceName,
internalModuleServiceFactory(Model)
)
}
})