chore: Rename entity to model (#7977)
**What** Start renaming `entity` to `model`
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
export type EntityDateColumns = "created_at" | "updated_at"
|
export type ModelDateColumns = "created_at" | "updated_at"
|
||||||
export type SoftDeletableEntityDateColumns = "deleted_at" | EntityDateColumns
|
export type SoftDeletableModelDateColumns = "deleted_at" | ModelDateColumns
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ export function buildLinkConfigFromLinkableKeys<
|
|||||||
* Reversed map from linkableKeys to entity name to linkable keys
|
* Reversed map from linkableKeys to entity name to linkable keys
|
||||||
* @param linkableKeys
|
* @param linkableKeys
|
||||||
*/
|
*/
|
||||||
export function buildEntitiesNameToLinkableKeysMap(
|
export function buildModelsNameToLinkableKeysMap(
|
||||||
linkableKeys: Record<string, string>
|
linkableKeys: Record<string, string>
|
||||||
): MapToConfig {
|
): MapToConfig {
|
||||||
const entityLinkableKeysMap: MapToConfig = {}
|
const entityLinkableKeysMap: MapToConfig = {}
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ import { InjectManager, MedusaContext } from "./decorators"
|
|||||||
import { ModuleRegistrationName } from "./definition"
|
import { ModuleRegistrationName } from "./definition"
|
||||||
import {
|
import {
|
||||||
BaseMethods,
|
BaseMethods,
|
||||||
EntitiesConfigTemplate,
|
|
||||||
ExtractKeysFromConfig,
|
ExtractKeysFromConfig,
|
||||||
MedusaServiceReturnType,
|
MedusaServiceReturnType,
|
||||||
ModelConfigurationsToConfigTemplate,
|
ModelConfigurationsToConfigTemplate,
|
||||||
TEntityEntries,
|
ModelEntries,
|
||||||
|
ModelsConfigTemplate,
|
||||||
} from "./types/medusa-service"
|
} from "./types/medusa-service"
|
||||||
import { buildEntitiesNameToLinkableKeysMap } from "./joiner-config-builder"
|
import { buildModelsNameToLinkableKeysMap } from "./joiner-config-builder"
|
||||||
|
|
||||||
const readMethods = ["retrieve", "list", "listAndCount"] as BaseMethods[]
|
const readMethods = ["retrieve", "list", "listAndCount"] as BaseMethods[]
|
||||||
const writeMethods = [
|
const writeMethods = [
|
||||||
@@ -47,7 +47,7 @@ const methods: BaseMethods[] = [...readMethods, ...writeMethods]
|
|||||||
*/
|
*/
|
||||||
function buildMethodNamesFromModel(
|
function buildMethodNamesFromModel(
|
||||||
modelName: string,
|
modelName: string,
|
||||||
model: TEntityEntries[keyof TEntityEntries]
|
model: ModelEntries[keyof ModelEntries]
|
||||||
): Record<string, string> {
|
): Record<string, string> {
|
||||||
return methods.reduce((acc, method) => {
|
return methods.reduce((acc, method) => {
|
||||||
let normalizedModelName: string = ""
|
let normalizedModelName: string = ""
|
||||||
@@ -79,11 +79,11 @@ export const MedusaServiceModelObjectsSymbol = Symbol.for(
|
|||||||
export const MedusaServiceSymbol = Symbol.for("MedusaServiceSymbol")
|
export const MedusaServiceSymbol = Symbol.for("MedusaServiceSymbol")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accessible from the MedusaService, holds the entity name to linkable keys map
|
* Accessible from the MedusaService, holds the model name to linkable keys map
|
||||||
* to be used for softDelete and restore methods
|
* to be used for softDelete and restore methods
|
||||||
*/
|
*/
|
||||||
export const MedusaServiceEntityNameToLinkableKeysMapSymbol = Symbol.for(
|
export const MedusaServiceModelNameToLinkableKeysMapSymbol = Symbol.for(
|
||||||
"MedusaServiceEntityNameToLinkableKeysMapSymbol"
|
"MedusaServiceModelNameToLinkableKeysMapSymbol"
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,7 +103,7 @@ export function isMedusaService(
|
|||||||
*
|
*
|
||||||
* // Here the DTO's and names will be inferred from the arguments
|
* // Here the DTO's and names will be inferred from the arguments
|
||||||
*
|
*
|
||||||
* const entities = {
|
* const models = {
|
||||||
* Currency,
|
* Currency,
|
||||||
* Price,
|
* Price,
|
||||||
* PriceList,
|
* PriceList,
|
||||||
@@ -114,21 +114,21 @@ export function isMedusaService(
|
|||||||
* RuleType,
|
* RuleType,
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* class MyService extends ModulesSdkUtils.MedusaService(entities) {}
|
* class MyService extends ModulesSdkUtils.MedusaService(models) {}
|
||||||
*
|
*
|
||||||
* @param entities
|
* @param models
|
||||||
*/
|
*/
|
||||||
export function MedusaService<
|
export function MedusaService<
|
||||||
const EntitiesConfig extends EntitiesConfigTemplate = { __empty: any },
|
const ModelsConfig extends ModelsConfigTemplate = { __empty: any },
|
||||||
const TEntities extends TEntityEntries<
|
const TModels extends ModelEntries<
|
||||||
ExtractKeysFromConfig<EntitiesConfig>
|
ExtractKeysFromConfig<ModelsConfig>
|
||||||
> = TEntityEntries<ExtractKeysFromConfig<EntitiesConfig>>
|
> = ModelEntries<ExtractKeysFromConfig<ModelsConfig>>
|
||||||
>(
|
>(
|
||||||
entities: TEntities
|
models: TModels
|
||||||
): MedusaServiceReturnType<
|
): MedusaServiceReturnType<
|
||||||
EntitiesConfig extends { __empty: any }
|
ModelsConfig extends { __empty: any }
|
||||||
? ModelConfigurationsToConfigTemplate<TEntities>
|
? ModelConfigurationsToConfigTemplate<TModels>
|
||||||
: EntitiesConfig
|
: ModelsConfig
|
||||||
> {
|
> {
|
||||||
const buildAndAssignMethodImpl = function (
|
const buildAndAssignMethodImpl = function (
|
||||||
klassPrototype: any,
|
klassPrototype: any,
|
||||||
@@ -168,11 +168,11 @@ export function MedusaService<
|
|||||||
config?: FindConfig<any>,
|
config?: FindConfig<any>,
|
||||||
sharedContext: Context = {}
|
sharedContext: Context = {}
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
const entities = await this.__container__[
|
const models = await this.__container__[
|
||||||
serviceRegistrationName
|
serviceRegistrationName
|
||||||
].retrieve(id, config, sharedContext)
|
].retrieve(id, config, sharedContext)
|
||||||
|
|
||||||
return await this.baseRepository_.serialize<T>(entities)
|
return await this.baseRepository_.serialize<T>(models)
|
||||||
}
|
}
|
||||||
|
|
||||||
applyMethod(methodImplementation, 2)
|
applyMethod(methodImplementation, 2)
|
||||||
@@ -186,8 +186,8 @@ export function MedusaService<
|
|||||||
): Promise<T | T[]> {
|
): Promise<T | T[]> {
|
||||||
const serviceData = Array.isArray(data) ? data : [data]
|
const serviceData = Array.isArray(data) ? data : [data]
|
||||||
const service = this.__container__[serviceRegistrationName]
|
const service = this.__container__[serviceRegistrationName]
|
||||||
const entities = await service.create(serviceData, sharedContext)
|
const models = await service.create(serviceData, sharedContext)
|
||||||
const response = Array.isArray(data) ? entities : entities[0]
|
const response = Array.isArray(data) ? models : models[0]
|
||||||
|
|
||||||
return await this.baseRepository_.serialize<T | T[]>(response)
|
return await this.baseRepository_.serialize<T | T[]>(response)
|
||||||
}
|
}
|
||||||
@@ -203,8 +203,8 @@ export function MedusaService<
|
|||||||
): Promise<T | T[]> {
|
): Promise<T | T[]> {
|
||||||
const serviceData = Array.isArray(data) ? data : [data]
|
const serviceData = Array.isArray(data) ? data : [data]
|
||||||
const service = this.__container__[serviceRegistrationName]
|
const service = this.__container__[serviceRegistrationName]
|
||||||
const entities = await service.update(serviceData, sharedContext)
|
const models = await service.update(serviceData, sharedContext)
|
||||||
const response = Array.isArray(data) ? entities : entities[0]
|
const response = Array.isArray(data) ? models : models[0]
|
||||||
|
|
||||||
return await this.baseRepository_.serialize<T | T[]>(response)
|
return await this.baseRepository_.serialize<T | T[]>(response)
|
||||||
}
|
}
|
||||||
@@ -220,9 +220,9 @@ export function MedusaService<
|
|||||||
sharedContext: Context = {}
|
sharedContext: Context = {}
|
||||||
): Promise<T[]> {
|
): Promise<T[]> {
|
||||||
const service = this.__container__[serviceRegistrationName]
|
const service = this.__container__[serviceRegistrationName]
|
||||||
const entities = await service.list(filters, config, sharedContext)
|
const models = await service.list(filters, config, sharedContext)
|
||||||
|
|
||||||
return await this.baseRepository_.serialize<T[]>(entities)
|
return await this.baseRepository_.serialize<T[]>(models)
|
||||||
}
|
}
|
||||||
|
|
||||||
applyMethod(methodImplementation, 2)
|
applyMethod(methodImplementation, 2)
|
||||||
@@ -235,11 +235,11 @@ export function MedusaService<
|
|||||||
config: FindConfig<any> = {},
|
config: FindConfig<any> = {},
|
||||||
sharedContext: Context = {}
|
sharedContext: Context = {}
|
||||||
): Promise<T[]> {
|
): Promise<T[]> {
|
||||||
const [entities, count] = await this.__container__[
|
const [models, count] = await this.__container__[
|
||||||
serviceRegistrationName
|
serviceRegistrationName
|
||||||
].listAndCount(filters, config, sharedContext)
|
].listAndCount(filters, config, sharedContext)
|
||||||
|
|
||||||
return [await this.baseRepository_.serialize<T[]>(entities), count]
|
return [await this.baseRepository_.serialize<T[]>(models), count]
|
||||||
}
|
}
|
||||||
|
|
||||||
applyMethod(methodImplementation, 2)
|
applyMethod(methodImplementation, 2)
|
||||||
@@ -283,16 +283,16 @@ export function MedusaService<
|
|||||||
? primaryKeyValues
|
? primaryKeyValues
|
||||||
: [primaryKeyValues]
|
: [primaryKeyValues]
|
||||||
|
|
||||||
const [entities, cascadedEntitiesMap] = await this.__container__[
|
const [models, cascadedModelsMap] = await this.__container__[
|
||||||
serviceRegistrationName
|
serviceRegistrationName
|
||||||
].softDelete(primaryKeyValues_, sharedContext)
|
].softDelete(primaryKeyValues_, sharedContext)
|
||||||
|
|
||||||
const softDeletedEntities = await this.baseRepository_.serialize<T[]>(
|
const softDeletedModels = await this.baseRepository_.serialize<T[]>(
|
||||||
entities
|
models
|
||||||
)
|
)
|
||||||
|
|
||||||
await this.eventBusModuleService_?.emit(
|
await this.eventBusModuleService_?.emit(
|
||||||
softDeletedEntities.map(({ id }) => ({
|
softDeletedModels.map(({ id }) => ({
|
||||||
eventName: `${kebabCase(modelName)}.deleted`,
|
eventName: `${kebabCase(modelName)}.deleted`,
|
||||||
metadata: { source: "", action: "", object: "" },
|
metadata: { source: "", action: "", object: "" },
|
||||||
data: { id },
|
data: { id },
|
||||||
@@ -301,15 +301,15 @@ export function MedusaService<
|
|||||||
|
|
||||||
// Map internal table/column names to their respective external linkable keys
|
// Map internal table/column names to their respective external linkable keys
|
||||||
// eg: product.id = product_id, variant.id = variant_id
|
// eg: product.id = product_id, variant.id = variant_id
|
||||||
const mappedCascadedEntitiesMap = mapObjectTo(
|
const mappedCascadedModelsMap = mapObjectTo(
|
||||||
cascadedEntitiesMap,
|
cascadedModelsMap,
|
||||||
this[MedusaServiceEntityNameToLinkableKeysMapSymbol],
|
this[MedusaServiceModelNameToLinkableKeysMapSymbol],
|
||||||
{
|
{
|
||||||
pick: config.returnLinkableKeys,
|
pick: config.returnLinkableKeys,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
return mappedCascadedEntitiesMap ? mappedCascadedEntitiesMap : void 0
|
return mappedCascadedModelsMap ? mappedCascadedModelsMap : void 0
|
||||||
}
|
}
|
||||||
|
|
||||||
applyMethod(methodImplementation, 2)
|
applyMethod(methodImplementation, 2)
|
||||||
@@ -326,22 +326,22 @@ export function MedusaService<
|
|||||||
? primaryKeyValues
|
? primaryKeyValues
|
||||||
: [primaryKeyValues]
|
: [primaryKeyValues]
|
||||||
|
|
||||||
const [_, cascadedEntitiesMap] = await this.__container__[
|
const [_, cascadedModelsMap] = await this.__container__[
|
||||||
serviceRegistrationName
|
serviceRegistrationName
|
||||||
].restore(primaryKeyValues_, sharedContext)
|
].restore(primaryKeyValues_, sharedContext)
|
||||||
|
|
||||||
let mappedCascadedEntitiesMap
|
let mappedCascadedModelsMap
|
||||||
// Map internal table/column names to their respective external linkable keys
|
// Map internal table/column names to their respective external linkable keys
|
||||||
// eg: product.id = product_id, variant.id = variant_id
|
// eg: product.id = product_id, variant.id = variant_id
|
||||||
mappedCascadedEntitiesMap = mapObjectTo(
|
mappedCascadedModelsMap = mapObjectTo(
|
||||||
cascadedEntitiesMap,
|
cascadedModelsMap,
|
||||||
this[MedusaServiceEntityNameToLinkableKeysMapSymbol],
|
this[MedusaServiceModelNameToLinkableKeysMapSymbol],
|
||||||
{
|
{
|
||||||
pick: config.returnLinkableKeys,
|
pick: config.returnLinkableKeys,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
return mappedCascadedEntitiesMap ? mappedCascadedEntitiesMap : void 0
|
return mappedCascadedModelsMap ? mappedCascadedModelsMap : void 0
|
||||||
}
|
}
|
||||||
|
|
||||||
applyMethod(methodImplementation, 2)
|
applyMethod(methodImplementation, 2)
|
||||||
@@ -354,13 +354,13 @@ export function MedusaService<
|
|||||||
[MedusaServiceSymbol] = true
|
[MedusaServiceSymbol] = true
|
||||||
|
|
||||||
static [MedusaServiceModelObjectsSymbol] =
|
static [MedusaServiceModelObjectsSymbol] =
|
||||||
entities as unknown as MedusaServiceReturnType<
|
models as unknown as MedusaServiceReturnType<
|
||||||
EntitiesConfig extends { __empty: any }
|
ModelsConfig extends { __empty: any }
|
||||||
? ModelConfigurationsToConfigTemplate<TEntities>
|
? ModelConfigurationsToConfigTemplate<TModels>
|
||||||
: EntitiesConfig
|
: ModelsConfig
|
||||||
>["$modelObjects"];
|
>["$modelObjects"];
|
||||||
|
|
||||||
[MedusaServiceEntityNameToLinkableKeysMapSymbol]: MapToConfig
|
[MedusaServiceModelNameToLinkableKeysMapSymbol]: MapToConfig
|
||||||
|
|
||||||
readonly __container__: Record<any, any>
|
readonly __container__: Record<any, any>
|
||||||
readonly baseRepository_: RepositoryService
|
readonly baseRepository_: RepositoryService
|
||||||
@@ -380,8 +380,8 @@ export function MedusaService<
|
|||||||
? this.__container__.eventBusModuleService
|
? this.__container__.eventBusModuleService
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
this[MedusaServiceEntityNameToLinkableKeysMapSymbol] =
|
this[MedusaServiceModelNameToLinkableKeysMapSymbol] =
|
||||||
buildEntitiesNameToLinkableKeysMap(
|
buildModelsNameToLinkableKeysMap(
|
||||||
this.__joinerConfig?.()?.linkableKeys ?? {}
|
this.__joinerConfig?.()?.linkableKeys ?? {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -404,18 +404,18 @@ export function MedusaService<
|
|||||||
* Build the retrieve/list/listAndCount/delete/softDelete/restore methods for all the other models
|
* Build the retrieve/list/listAndCount/delete/softDelete/restore methods for all the other models
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const entitiesMethods: [
|
const modelsMethods: [
|
||||||
string,
|
string,
|
||||||
TEntities[keyof TEntities],
|
TModels[keyof TModels],
|
||||||
Record<string, string>
|
Record<string, string>
|
||||||
][] = Object.entries(entities as {}).map(([name, config]) => [
|
][] = Object.entries(models as {}).map(([name, config]) => [
|
||||||
name,
|
name,
|
||||||
config as TEntities[keyof TEntities],
|
config as TModels[keyof TModels],
|
||||||
buildMethodNamesFromModel(name, config as TEntities[keyof TEntities]),
|
buildMethodNamesFromModel(name, config as TModels[keyof TModels]),
|
||||||
])
|
])
|
||||||
|
|
||||||
for (let [modelName, model, modelsMethods] of entitiesMethods) {
|
for (let [modelName, model, modelMethods] of modelsMethods) {
|
||||||
Object.entries(modelsMethods).forEach(([method, methodName]) => {
|
Object.entries(modelMethods).forEach(([method, methodName]) => {
|
||||||
buildAndAssignMethodImpl(
|
buildAndAssignMethodImpl(
|
||||||
AbstractModuleService_.prototype,
|
AbstractModuleService_.prototype,
|
||||||
method,
|
method,
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ export type ModelDTOConfig = {
|
|||||||
plural?: string
|
plural?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type EntitiesConfigTemplate = { [key: string]: ModelDTOConfig }
|
export type ModelsConfigTemplate = { [key: string]: ModelDTOConfig }
|
||||||
|
|
||||||
export type ModelConfigurationsToConfigTemplate<T extends TEntityEntries> = {
|
export type ModelConfigurationsToConfigTemplate<T extends ModelEntries> = {
|
||||||
[Key in keyof T]: {
|
[Key in keyof T]: {
|
||||||
dto: T[Key] extends Constructor<any> ? InstanceType<T[Key]> : any
|
dto: T[Key] extends Constructor<any> ? InstanceType<T[Key]> : any
|
||||||
model: T[Key] extends { model: infer MODEL }
|
model: T[Key] extends { model: infer MODEL }
|
||||||
@@ -90,7 +90,7 @@ export type ExtractPluralName<
|
|||||||
>
|
>
|
||||||
|
|
||||||
// TODO: The future expected entry will be a MODEL object but in the meantime we have to maintain backward compatibility for ouw own modules and therefore we need to support Constructor<any> as well as this temporary object
|
// TODO: The future expected entry will be a MODEL object but in the meantime we have to maintain backward compatibility for ouw own modules and therefore we need to support Constructor<any> as well as this temporary object
|
||||||
export type TEntityEntries<Keys = string> = Record<
|
export type ModelEntries<Keys = string> = Record<
|
||||||
Keys & string,
|
Keys & string,
|
||||||
| DmlEntity<any, any>
|
| DmlEntity<any, any>
|
||||||
/**
|
/**
|
||||||
@@ -103,45 +103,45 @@ export type TEntityEntries<Keys = string> = Record<
|
|||||||
| { name?: string; singular?: string; plural?: string }
|
| { name?: string; singular?: string; plural?: string }
|
||||||
>
|
>
|
||||||
|
|
||||||
export type ExtractKeysFromConfig<EntitiesConfig> = EntitiesConfig extends {
|
export type ExtractKeysFromConfig<ModelsConfig> = ModelsConfig extends {
|
||||||
__empty: any
|
__empty: any
|
||||||
}
|
}
|
||||||
? string
|
? string
|
||||||
: keyof EntitiesConfig
|
: keyof ModelsConfig
|
||||||
|
|
||||||
export type AbstractModuleService<
|
export type AbstractModuleService<
|
||||||
TEntitiesDtoConfig extends Record<string, any>
|
TModelsDtoConfig extends Record<string, any>
|
||||||
> = {
|
> = {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `retrieve${ExtractSingularName<
|
[TModelName in keyof TModelsDtoConfig as `retrieve${ExtractSingularName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: (
|
>}`]: (
|
||||||
id: string,
|
id: string,
|
||||||
config?: FindConfig<any>,
|
config?: FindConfig<any>,
|
||||||
sharedContext?: Context
|
sharedContext?: Context
|
||||||
) => Promise<TEntitiesDtoConfig[TEntityName]["dto"]>
|
) => Promise<TModelsDtoConfig[TModelName]["dto"]>
|
||||||
} & {
|
} & {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `list${ExtractPluralName<
|
[TModelName in keyof TModelsDtoConfig as `list${ExtractPluralName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: (
|
>}`]: (
|
||||||
filters?: any,
|
filters?: any,
|
||||||
config?: FindConfig<any>,
|
config?: FindConfig<any>,
|
||||||
sharedContext?: Context
|
sharedContext?: Context
|
||||||
) => Promise<TEntitiesDtoConfig[TEntityName]["dto"][]>
|
) => Promise<TModelsDtoConfig[TModelName]["dto"][]>
|
||||||
} & {
|
} & {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `listAndCount${ExtractPluralName<
|
[TModelName in keyof TModelsDtoConfig as `listAndCount${ExtractPluralName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: {
|
>}`]: {
|
||||||
(filters?: any, config?: FindConfig<any>, sharedContext?: Context): Promise<
|
(filters?: any, config?: FindConfig<any>, sharedContext?: Context): Promise<
|
||||||
[TEntitiesDtoConfig[TEntityName]["dto"][], number]
|
[TModelsDtoConfig[TModelName]["dto"][], number]
|
||||||
>
|
>
|
||||||
}
|
}
|
||||||
} & {
|
} & {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `delete${ExtractPluralName<
|
[TModelName in keyof TModelsDtoConfig as `delete${ExtractPluralName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: {
|
>}`]: {
|
||||||
(
|
(
|
||||||
primaryKeyValues: string | object | string[] | object[],
|
primaryKeyValues: string | object | string[] | object[],
|
||||||
@@ -149,9 +149,9 @@ export type AbstractModuleService<
|
|||||||
): Promise<void>
|
): Promise<void>
|
||||||
}
|
}
|
||||||
} & {
|
} & {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `softDelete${ExtractPluralName<
|
[TModelName in keyof TModelsDtoConfig as `softDelete${ExtractPluralName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: {
|
>}`]: {
|
||||||
<TReturnableLinkableKeys extends string>(
|
<TReturnableLinkableKeys extends string>(
|
||||||
primaryKeyValues: string | object | string[] | object[],
|
primaryKeyValues: string | object | string[] | object[],
|
||||||
@@ -160,9 +160,9 @@ export type AbstractModuleService<
|
|||||||
): Promise<Record<string, string[]> | void>
|
): Promise<Record<string, string[]> | void>
|
||||||
}
|
}
|
||||||
} & {
|
} & {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `restore${ExtractPluralName<
|
[TModelName in keyof TModelsDtoConfig as `restore${ExtractPluralName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: {
|
>}`]: {
|
||||||
<TReturnableLinkableKeys extends string>(
|
<TReturnableLinkableKeys extends string>(
|
||||||
primaryKeyValues: string | object | string[] | object[],
|
primaryKeyValues: string | object | string[] | object[],
|
||||||
@@ -171,16 +171,16 @@ export type AbstractModuleService<
|
|||||||
): Promise<Record<string, string[]> | void>
|
): Promise<Record<string, string[]> | void>
|
||||||
}
|
}
|
||||||
} & {
|
} & {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `create${ExtractPluralName<
|
[TModelName in keyof TModelsDtoConfig as `create${ExtractPluralName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: {
|
>}`]: {
|
||||||
(...args: any[]): Promise<any>
|
(...args: any[]): Promise<any>
|
||||||
}
|
}
|
||||||
} & {
|
} & {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `update${ExtractPluralName<
|
[TModelName in keyof TModelsDtoConfig as `update${ExtractPluralName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: {
|
>}`]: {
|
||||||
(...args: any[]): Promise<any>
|
(...args: any[]): Promise<any>
|
||||||
}
|
}
|
||||||
@@ -190,53 +190,53 @@ export type AbstractModuleService<
|
|||||||
|
|
||||||
// are not consistent accross modules
|
// are not consistent accross modules
|
||||||
/* & {
|
/* & {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `create${ExtractPluralName<
|
[TModelName in keyof TModelsDtoConfig as `create${ExtractPluralName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: {
|
>}`]: {
|
||||||
(data: any[], sharedContext?: Context): Promise<
|
(data: any[], sharedContext?: Context): Promise<
|
||||||
TEntitiesDtoConfig[TEntityName]["dto"][]
|
TModelsDtoConfig[TModelName]["dto"][]
|
||||||
>
|
>
|
||||||
}
|
}
|
||||||
} & {
|
} & {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `create${ExtractPluralName<
|
[TModelName in keyof TModelsDtoConfig as `create${ExtractPluralName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: {
|
>}`]: {
|
||||||
(data: any, sharedContext?: Context): Promise<
|
(data: any, sharedContext?: Context): Promise<
|
||||||
TEntitiesDtoConfig[TEntityName]["dto"][]
|
TModelsDtoConfig[TModelName]["dto"][]
|
||||||
>
|
>
|
||||||
}
|
}
|
||||||
} & {
|
} & {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `update${ExtractPluralName<
|
[TModelName in keyof TModelsDtoConfig as `update${ExtractPluralName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: {
|
>}`]: {
|
||||||
(
|
(
|
||||||
data: TEntitiesDtoConfig[TEntityName]["update"][],
|
data: TModelsDtoConfig[TModelName]["update"][],
|
||||||
sharedContext?: Context
|
sharedContext?: Context
|
||||||
): Promise<TEntitiesDtoConfig[TEntityName]["dto"][]>
|
): Promise<TModelsDtoConfig[TModelName]["dto"][]>
|
||||||
}
|
}
|
||||||
} & {
|
} & {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `update${ExtractPluralName<
|
[TModelName in keyof TModelsDtoConfig as `update${ExtractPluralName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: {
|
>}`]: {
|
||||||
(
|
(
|
||||||
data: TEntitiesDtoConfig[TEntityName]["update"],
|
data: TModelsDtoConfig[TModelName]["update"],
|
||||||
sharedContext?: Context
|
sharedContext?: Context
|
||||||
): Promise<TEntitiesDtoConfig[TEntityName]["dto"]>
|
): Promise<TModelsDtoConfig[TModelName]["dto"]>
|
||||||
}
|
}
|
||||||
} & {
|
} & {
|
||||||
[TEntityName in keyof TEntitiesDtoConfig as `update${ExtractPluralName<
|
[TModelName in keyof TModelsDtoConfig as `update${ExtractPluralName<
|
||||||
TEntitiesDtoConfig,
|
TModelsDtoConfig,
|
||||||
TEntityName
|
TModelName
|
||||||
>}`]: {
|
>}`]: {
|
||||||
(
|
(
|
||||||
idOrdSelector: any,
|
idOrdSelector: any,
|
||||||
data: TEntitiesDtoConfig[TEntityName]["update"],
|
data: TModelsDtoConfig[TModelName]["update"],
|
||||||
sharedContext?: Context
|
sharedContext?: Context
|
||||||
): Promise<TEntitiesDtoConfig[TEntityName]["dto"][]>
|
): Promise<TModelsDtoConfig[TModelName]["dto"][]>
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
Property,
|
Property,
|
||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
|
|
||||||
type OptionalAddressProps = DAL.SoftDeletableEntityDateColumns
|
type OptionalAddressProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
@Entity({ tableName: "cart_address" })
|
@Entity({ tableName: "cart_address" })
|
||||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { DAL } from "@medusajs/types"
|
|||||||
import { BigNumber, MikroOrmBigNumberProperty } from "@medusajs/utils"
|
import { BigNumber, MikroOrmBigNumberProperty } from "@medusajs/utils"
|
||||||
import { OptionalProps, PrimaryKey, Property } from "@mikro-orm/core"
|
import { OptionalProps, PrimaryKey, Property } from "@mikro-orm/core"
|
||||||
|
|
||||||
type OptionalAdjustmentLineProps = DAL.SoftDeletableEntityDateColumns
|
type OptionalAdjustmentLineProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* As per the Mikro ORM docs, superclasses should use the abstract class definition
|
* As per the Mikro ORM docs, superclasses should use the abstract class definition
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import ShippingMethod from "./shipping-method"
|
|||||||
type OptionalCartProps =
|
type OptionalCartProps =
|
||||||
| "shipping_address"
|
| "shipping_address"
|
||||||
| "billing_address"
|
| "billing_address"
|
||||||
| DAL.SoftDeletableEntityDateColumns
|
| DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const RegionIdIndex = createPsqlIndexStatementHelper({
|
const RegionIdIndex = createPsqlIndexStatementHelper({
|
||||||
name: "IDX_cart_region_id",
|
name: "IDX_cart_region_id",
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ type OptionalLineItemProps =
|
|||||||
| "compare_at_unit_price"
|
| "compare_at_unit_price"
|
||||||
| "requires_shipping"
|
| "requires_shipping"
|
||||||
| "cart"
|
| "cart"
|
||||||
| DAL.SoftDeletableEntityDateColumns
|
| DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const CartIdIndex = createPsqlIndexStatementHelper({
|
const CartIdIndex = createPsqlIndexStatementHelper({
|
||||||
name: "IDX_line_item_cart_id",
|
name: "IDX_line_item_cart_id",
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import ShippingMethodTaxLine from "./shipping-method-tax-line"
|
|||||||
type OptionalShippingMethodProps =
|
type OptionalShippingMethodProps =
|
||||||
| "cart"
|
| "cart"
|
||||||
| "is_tax_inclusive"
|
| "is_tax_inclusive"
|
||||||
| DAL.SoftDeletableEntityDateColumns
|
| DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const CartIdIndex = createPsqlIndexStatementHelper({
|
const CartIdIndex = createPsqlIndexStatementHelper({
|
||||||
name: "IDX_shipping_method_cart_id",
|
name: "IDX_shipping_method_cart_id",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { DAL } from "@medusajs/types"
|
import { DAL } from "@medusajs/types"
|
||||||
import { OptionalProps, PrimaryKey, Property } from "@mikro-orm/core"
|
import { OptionalProps, PrimaryKey, Property } from "@mikro-orm/core"
|
||||||
|
|
||||||
type OptionalTaxLineProps = DAL.SoftDeletableEntityDateColumns
|
type OptionalTaxLineProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* As per the Mikro ORM docs, superclasses should use the abstract class definition
|
* As per the Mikro ORM docs, superclasses should use the abstract class definition
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import Customer from "./customer"
|
import Customer from "./customer"
|
||||||
|
|
||||||
type OptionalAddressProps = DAL.EntityDateColumns // TODO: To be revisited when more clear
|
type OptionalAddressProps = DAL.ModelDateColumns // TODO: To be revisited when more clear
|
||||||
|
|
||||||
const CustomerAddressUniqueCustomerShippingAddress =
|
const CustomerAddressUniqueCustomerShippingAddress =
|
||||||
createPsqlIndexStatementHelper({
|
createPsqlIndexStatementHelper({
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
import Customer from "./customer"
|
import Customer from "./customer"
|
||||||
import CustomerGroup from "./customer-group"
|
import CustomerGroup from "./customer-group"
|
||||||
|
|
||||||
type OptionalGroupProps = "customer_group" | "customer" | DAL.EntityDateColumns // TODO: To be revisited when more clear
|
type OptionalGroupProps = "customer_group" | "customer" | DAL.ModelDateColumns // TODO: To be revisited when more clear
|
||||||
|
|
||||||
@Entity({ tableName: "customer_group_customer" })
|
@Entity({ tableName: "customer_group_customer" })
|
||||||
export default class CustomerGroupCustomer {
|
export default class CustomerGroupCustomer {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
import Customer from "./customer"
|
import Customer from "./customer"
|
||||||
import CustomerGroupCustomer from "./customer-group-customer"
|
import CustomerGroupCustomer from "./customer-group-customer"
|
||||||
|
|
||||||
type OptionalGroupProps = DAL.SoftDeletableEntityDateColumns // TODO: To be revisited when more clear
|
type OptionalGroupProps = DAL.SoftDeletableModelDateColumns // TODO: To be revisited when more clear
|
||||||
|
|
||||||
const CustomerGroupUniqueName = createPsqlIndexStatementHelper({
|
const CustomerGroupUniqueName = createPsqlIndexStatementHelper({
|
||||||
tableName: "customer_group",
|
tableName: "customer_group",
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import CustomerGroupCustomer from "./customer-group-customer"
|
|||||||
type OptionalCustomerProps =
|
type OptionalCustomerProps =
|
||||||
| "groups"
|
| "groups"
|
||||||
| "addresses"
|
| "addresses"
|
||||||
| DAL.SoftDeletableEntityDateColumns
|
| DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const CustomerUniqueEmail = createPsqlIndexStatementHelper({
|
const CustomerUniqueEmail = createPsqlIndexStatementHelper({
|
||||||
tableName: "customer",
|
tableName: "customer",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
Property,
|
Property,
|
||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
|
|
||||||
type OptionalAddressProps = DAL.SoftDeletableEntityDateColumns
|
type OptionalAddressProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const FulfillmentDeletedAtIndex = createPsqlIndexStatementHelper({
|
const FulfillmentDeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "fulfillment_address",
|
tableName: "fulfillment_address",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import Fulfillment from "./fulfillment"
|
import Fulfillment from "./fulfillment"
|
||||||
|
|
||||||
type FulfillmentItemOptionalProps = DAL.SoftDeletableEntityDateColumns
|
type FulfillmentItemOptionalProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const FulfillmentIdIndex = createPsqlIndexStatementHelper({
|
const FulfillmentIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "fulfillment_item",
|
tableName: "fulfillment_item",
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import Fulfillment from "./fulfillment"
|
import Fulfillment from "./fulfillment"
|
||||||
|
|
||||||
type FulfillmentLabelOptionalProps = DAL.SoftDeletableEntityDateColumns
|
type FulfillmentLabelOptionalProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const FulfillmentIdIndex = createPsqlIndexStatementHelper({
|
const FulfillmentIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "fulfillment_label",
|
tableName: "fulfillment_label",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import ServiceZone from "./service-zone"
|
import ServiceZone from "./service-zone"
|
||||||
|
|
||||||
type FulfillmentSetOptionalProps = DAL.SoftDeletableEntityDateColumns
|
type FulfillmentSetOptionalProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "fulfillment_set",
|
tableName: "fulfillment_set",
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import FulfillmentLabel from "./fulfillment-label"
|
|||||||
import FulfillmentProvider from "./fulfillment-provider"
|
import FulfillmentProvider from "./fulfillment-provider"
|
||||||
import ShippingOption from "./shipping-option"
|
import ShippingOption from "./shipping-option"
|
||||||
|
|
||||||
type FulfillmentOptionalProps = DAL.SoftDeletableEntityDateColumns
|
type FulfillmentOptionalProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const FulfillmentDeletedAtIndex = createPsqlIndexStatementHelper({
|
const FulfillmentDeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "fulfillment",
|
tableName: "fulfillment",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import ServiceZone from "./service-zone"
|
import ServiceZone from "./service-zone"
|
||||||
|
|
||||||
type GeoZoneOptionalProps = DAL.SoftDeletableEntityDateColumns
|
type GeoZoneOptionalProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "geo_zone",
|
tableName: "geo_zone",
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import FulfillmentSet from "./fulfillment-set"
|
|||||||
import GeoZone from "./geo-zone"
|
import GeoZone from "./geo-zone"
|
||||||
import ShippingOption from "./shipping-option"
|
import ShippingOption from "./shipping-option"
|
||||||
|
|
||||||
type ServiceZoneOptionalProps = DAL.SoftDeletableEntityDateColumns
|
type ServiceZoneOptionalProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const deletedAtIndexName = "IDX_service_zone_deleted_at"
|
const deletedAtIndexName = "IDX_service_zone_deleted_at"
|
||||||
const deletedAtIndexStatement = createPsqlIndexStatementHelper({
|
const deletedAtIndexStatement = createPsqlIndexStatementHelper({
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import ShippingOption from "./shipping-option"
|
import ShippingOption from "./shipping-option"
|
||||||
|
|
||||||
type ShippingOptionRuleOptionalProps = DAL.SoftDeletableEntityDateColumns
|
type ShippingOptionRuleOptionalProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "shipping_option_rule",
|
tableName: "shipping_option_rule",
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import ShippingOption from "./shipping-option"
|
import ShippingOption from "./shipping-option"
|
||||||
|
|
||||||
type ShippingOptionTypeOptionalProps = DAL.SoftDeletableEntityDateColumns
|
type ShippingOptionTypeOptionalProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "shipping_option_type",
|
tableName: "shipping_option_type",
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import ShippingOptionRule from "./shipping-option-rule"
|
|||||||
import ShippingOptionType from "./shipping-option-type"
|
import ShippingOptionType from "./shipping-option-type"
|
||||||
import ShippingProfile from "./shipping-profile"
|
import ShippingProfile from "./shipping-profile"
|
||||||
|
|
||||||
type ShippingOptionOptionalProps = DAL.SoftDeletableEntityDateColumns
|
type ShippingOptionOptionalProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "shipping_option",
|
tableName: "shipping_option",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import ShippingOption from "./shipping-option"
|
import ShippingOption from "./shipping-option"
|
||||||
|
|
||||||
type ShippingProfileOptionalProps = DAL.SoftDeletableEntityDateColumns
|
type ShippingProfileOptionalProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "shipping_profile",
|
tableName: "shipping_profile",
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const InventoryItemSkuIndex = createPsqlIndexStatementHelper({
|
|||||||
unique: true,
|
unique: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
type InventoryItemOptionalProps = DAL.SoftDeletableEntityDateColumns
|
type InventoryItemOptionalProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
Property,
|
Property,
|
||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
|
|
||||||
type OptionalAddressProps = DAL.EntityDateColumns
|
type OptionalAddressProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const CustomerIdIndex = createPsqlIndexStatementHelper({
|
const CustomerIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order_address",
|
tableName: "order_address",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { BigNumberRawValue, DAL } from "@medusajs/types"
|
|||||||
import { BigNumber, MikroOrmBigNumberProperty } from "@medusajs/utils"
|
import { BigNumber, MikroOrmBigNumberProperty } from "@medusajs/utils"
|
||||||
import { OptionalProps, PrimaryKey, Property } from "@mikro-orm/core"
|
import { OptionalProps, PrimaryKey, Property } from "@mikro-orm/core"
|
||||||
|
|
||||||
type OptionalAdjustmentLineProps = DAL.EntityDateColumns
|
type OptionalAdjustmentLineProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* As per the Mikro ORM docs, superclasses should use the abstract class definition
|
* As per the Mikro ORM docs, superclasses should use the abstract class definition
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import ClaimItem from "./claim-item"
|
import ClaimItem from "./claim-item"
|
||||||
|
|
||||||
type OptionalClaimItemImageProps = DAL.EntityDateColumns
|
type OptionalClaimItemImageProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const ClaimItemImageDeletedAtIndex = createPsqlIndexStatementHelper({
|
const ClaimItemImageDeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order_claim_item_image",
|
tableName: "order_claim_item_image",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import Claim from "./claim"
|
|||||||
import ClaimItemImage from "./claim-item-image"
|
import ClaimItemImage from "./claim-item-image"
|
||||||
import LineItem from "./line-item"
|
import LineItem from "./line-item"
|
||||||
|
|
||||||
type OptionalLineItemProps = DAL.EntityDateColumns
|
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const ClaimIdIndex = createPsqlIndexStatementHelper({
|
const ClaimIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order_claim_item",
|
tableName: "order_claim_item",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import OrderShippingMethod from "./order-shipping-method"
|
|||||||
import Return from "./return"
|
import Return from "./return"
|
||||||
import Transaction from "./transaction"
|
import Transaction from "./transaction"
|
||||||
|
|
||||||
type OptionalOrderClaimProps = DAL.EntityDateColumns
|
type OptionalOrderClaimProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const DisplayIdIndex = createPsqlIndexStatementHelper({
|
const DisplayIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order_claim",
|
tableName: "order_claim",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
import Exchange from "./exchange"
|
import Exchange from "./exchange"
|
||||||
import LineItem from "./line-item"
|
import LineItem from "./line-item"
|
||||||
|
|
||||||
type OptionalLineItemProps = DAL.EntityDateColumns
|
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const ExchangeIdIndex = createPsqlIndexStatementHelper({
|
const ExchangeIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order_exchange_item",
|
tableName: "order_exchange_item",
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import Order from "./order"
|
|||||||
import OrderShippingMethod from "./order-shipping-method"
|
import OrderShippingMethod from "./order-shipping-method"
|
||||||
import Return from "./return"
|
import Return from "./return"
|
||||||
|
|
||||||
type OptionalOrderExchangeProps = DAL.EntityDateColumns
|
type OptionalOrderExchangeProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const DisplayIdIndex = createPsqlIndexStatementHelper({
|
const DisplayIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order_exchange",
|
tableName: "order_exchange",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
import LineItemAdjustment from "./line-item-adjustment"
|
import LineItemAdjustment from "./line-item-adjustment"
|
||||||
import LineItemTaxLine from "./line-item-tax-line"
|
import LineItemTaxLine from "./line-item-tax-line"
|
||||||
|
|
||||||
type OptionalLineItemProps = DAL.EntityDateColumns
|
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const ProductIdIndex = createPsqlIndexStatementHelper({
|
const ProductIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order_line_item",
|
tableName: "order_line_item",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import Order from "./order"
|
|||||||
import OrderChange from "./order-change"
|
import OrderChange from "./order-change"
|
||||||
import Return from "./return"
|
import Return from "./return"
|
||||||
|
|
||||||
type OptionalLineItemProps = DAL.EntityDateColumns
|
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const OrderChangeIdIndex = createPsqlIndexStatementHelper({
|
const OrderChangeIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order_change_action",
|
tableName: "order_change_action",
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import Order from "./order"
|
|||||||
import OrderChangeAction from "./order-change-action"
|
import OrderChangeAction from "./order-change-action"
|
||||||
import Return from "./return"
|
import Return from "./return"
|
||||||
|
|
||||||
type OptionalLineItemProps = DAL.EntityDateColumns
|
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const OrderIdIndex = createPsqlIndexStatementHelper({
|
const OrderIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order_change",
|
tableName: "order_change",
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
import LineItem from "./line-item"
|
import LineItem from "./line-item"
|
||||||
import Order from "./order"
|
import Order from "./order"
|
||||||
|
|
||||||
type OptionalLineItemProps = DAL.EntityDateColumns
|
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const OrderIdIndex = createPsqlIndexStatementHelper({
|
const OrderIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order_item",
|
tableName: "order_item",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import Order from "./order"
|
|||||||
import Return from "./return"
|
import Return from "./return"
|
||||||
import ShippingMethod from "./shipping-method"
|
import ShippingMethod from "./shipping-method"
|
||||||
|
|
||||||
type OptionalShippingMethodProps = DAL.EntityDateColumns
|
type OptionalShippingMethodProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const OrderIdIndex = createPsqlIndexStatementHelper({
|
const OrderIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order_shipping",
|
tableName: "order_shipping",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import Transaction from "./transaction"
|
|||||||
type OptionalOrderProps =
|
type OptionalOrderProps =
|
||||||
| "shipping_address"
|
| "shipping_address"
|
||||||
| "billing_address"
|
| "billing_address"
|
||||||
| DAL.EntityDateColumns
|
| DAL.ModelDateColumns
|
||||||
|
|
||||||
const DisplayIdIndex = createPsqlIndexStatementHelper({
|
const DisplayIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order",
|
tableName: "order",
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import LineItem from "./line-item"
|
|||||||
import Return from "./return"
|
import Return from "./return"
|
||||||
import ReturnReason from "./return-reason"
|
import ReturnReason from "./return-reason"
|
||||||
|
|
||||||
type OptionalLineItemProps = DAL.EntityDateColumns
|
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const ReturnIdIndex = createPsqlIndexStatementHelper({
|
const ReturnIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "return_item",
|
tableName: "return_item",
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const ParentIndex = createPsqlIndexStatementHelper({
|
|||||||
where: "deleted_at IS NOT NULL",
|
where: "deleted_at IS NOT NULL",
|
||||||
})
|
})
|
||||||
|
|
||||||
type OptionalOrderProps = "parent_return_reason" | DAL.EntityDateColumns
|
type OptionalOrderProps = "parent_return_reason" | DAL.ModelDateColumns
|
||||||
|
|
||||||
@Entity({ tableName: "return_reason" })
|
@Entity({ tableName: "return_reason" })
|
||||||
export default class ReturnReason {
|
export default class ReturnReason {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import Exchange from "./exchange"
|
|||||||
import Order from "./order"
|
import Order from "./order"
|
||||||
import OrderShippingMethod from "./order-shipping-method"
|
import OrderShippingMethod from "./order-shipping-method"
|
||||||
|
|
||||||
type OptionalReturnProps = DAL.EntityDateColumns
|
type OptionalReturnProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const DisplayIdIndex = createPsqlIndexStatementHelper({
|
const DisplayIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "return",
|
tableName: "return",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import Exchange from "./exchange"
|
|||||||
import Order from "./order"
|
import Order from "./order"
|
||||||
import Return from "./return"
|
import Return from "./return"
|
||||||
|
|
||||||
type OptionalLineItemProps = DAL.EntityDateColumns
|
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
const ReferenceIdIndex = createPsqlIndexStatementHelper({
|
const ReferenceIdIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "order_transaction",
|
tableName: "order_transaction",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import Payment from "./payment"
|
|||||||
import PaymentProvider from "./payment-provider"
|
import PaymentProvider from "./payment-provider"
|
||||||
import PaymentSession from "./payment-session"
|
import PaymentSession from "./payment-session"
|
||||||
|
|
||||||
type OptionalPaymentCollectionProps = "status" | DAL.EntityDateColumns
|
type OptionalPaymentCollectionProps = "status" | DAL.ModelDateColumns
|
||||||
|
|
||||||
@Entity({ tableName: "payment_collection" })
|
@Entity({ tableName: "payment_collection" })
|
||||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import PaymentCollection from "./payment-collection"
|
|||||||
import PaymentSession from "./payment-session"
|
import PaymentSession from "./payment-session"
|
||||||
import Refund from "./refund"
|
import Refund from "./refund"
|
||||||
|
|
||||||
type OptionalPaymentProps = DAL.EntityDateColumns
|
type OptionalPaymentProps = DAL.ModelDateColumns
|
||||||
|
|
||||||
@Entity({ tableName: "payment" })
|
@Entity({ tableName: "payment" })
|
||||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import PriceList from "./price-list"
|
import PriceList from "./price-list"
|
||||||
|
|
||||||
type OptionalFields = DAL.SoftDeletableEntityDateColumns
|
type OptionalFields = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const tableName = "price_list_rule"
|
const tableName = "price_list_rule"
|
||||||
const PriceListRuleDeletedAtIndex = createPsqlIndexStatementHelper({
|
const PriceListRuleDeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import PriceListRule from "./price-list-rule"
|
|||||||
type OptionalFields =
|
type OptionalFields =
|
||||||
| "starts_at"
|
| "starts_at"
|
||||||
| "ends_at"
|
| "ends_at"
|
||||||
| DAL.SoftDeletableEntityDateColumns
|
| DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const tableName = "price_list"
|
const tableName = "price_list"
|
||||||
const PriceListDeletedAtIndex = createPsqlIndexStatementHelper({
|
const PriceListDeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import Price from "./price"
|
import Price from "./price"
|
||||||
|
|
||||||
type OptionalFields = DAL.SoftDeletableEntityDateColumns
|
type OptionalFields = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const tableName = "price_rule"
|
const tableName = "price_rule"
|
||||||
const PriceRuleDeletedAtIndex = createPsqlIndexStatementHelper({
|
const PriceRuleDeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import PriceList from "./price-list"
|
|||||||
import PriceRule from "./price-rule"
|
import PriceRule from "./price-rule"
|
||||||
import PriceSet from "./price-set"
|
import PriceSet from "./price-set"
|
||||||
|
|
||||||
type OptionalFields = DAL.SoftDeletableEntityDateColumns
|
type OptionalFields = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const tableName = "price"
|
const tableName = "price"
|
||||||
const PriceDeletedAtIndex = createPsqlIndexStatementHelper({
|
const PriceDeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ type OptionalFields =
|
|||||||
| "description"
|
| "description"
|
||||||
| "limit"
|
| "limit"
|
||||||
| "used"
|
| "used"
|
||||||
| DAL.SoftDeletableEntityDateColumns
|
| DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
@Entity({ tableName: "promotion_campaign_budget" })
|
@Entity({ tableName: "promotion_campaign_budget" })
|
||||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type OptionalFields =
|
|||||||
| "description"
|
| "description"
|
||||||
| "starts_at"
|
| "starts_at"
|
||||||
| "ends_at"
|
| "ends_at"
|
||||||
| DAL.SoftDeletableEntityDateColumns
|
| DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const tableName = "promotion_campaign"
|
const tableName = "promotion_campaign"
|
||||||
const CampaignUniqueCampaignIdentifier = createPsqlIndexStatementHelper({
|
const CampaignUniqueCampaignIdentifier = createPsqlIndexStatementHelper({
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import ApplicationMethod from "./application-method"
|
|||||||
import Promotion from "./promotion"
|
import Promotion from "./promotion"
|
||||||
import PromotionRuleValue from "./promotion-rule-value"
|
import PromotionRuleValue from "./promotion-rule-value"
|
||||||
|
|
||||||
type OptionalFields = "description" | DAL.SoftDeletableEntityDateColumns
|
type OptionalFields = "description" | DAL.SoftDeletableModelDateColumns
|
||||||
type OptionalRelations = "values" | "promotions"
|
type OptionalRelations = "values" | "promotions"
|
||||||
|
|
||||||
@Entity({ tableName: "promotion_rule" })
|
@Entity({ tableName: "promotion_rule" })
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import ApplicationMethod from "./application-method"
|
|||||||
import Campaign from "./campaign"
|
import Campaign from "./campaign"
|
||||||
import PromotionRule from "./promotion-rule"
|
import PromotionRule from "./promotion-rule"
|
||||||
|
|
||||||
type OptionalFields = "is_automatic" | DAL.SoftDeletableEntityDateColumns
|
type OptionalFields = "is_automatic" | DAL.SoftDeletableModelDateColumns
|
||||||
type OptionalRelations = "application_method" | "campaign"
|
type OptionalRelations = "application_method" | "campaign"
|
||||||
|
|
||||||
@Entity({ tableName: "promotion" })
|
@Entity({ tableName: "promotion" })
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
Property,
|
Property,
|
||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
|
|
||||||
type SalesChannelOptionalProps = "is_disabled" | DAL.EntityDateColumns
|
type SalesChannelOptionalProps = "is_disabled" | DAL.ModelDateColumns
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import StoreCurrency from "./currency"
|
import StoreCurrency from "./currency"
|
||||||
|
|
||||||
type StoreOptionalProps = DAL.SoftDeletableEntityDateColumns
|
type StoreOptionalProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const StoreDeletedAtIndex = createPsqlIndexStatementHelper({
|
const StoreDeletedAtIndex = createPsqlIndexStatementHelper({
|
||||||
tableName: "store",
|
tableName: "store",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import TaxRate from "./tax-rate"
|
|||||||
|
|
||||||
const TABLE_NAME = "tax_rate_rule"
|
const TABLE_NAME = "tax_rate_rule"
|
||||||
|
|
||||||
type OptionalRuleProps = DAL.SoftDeletableEntityDateColumns
|
type OptionalRuleProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const taxRateIdIndexName = "IDX_tax_rate_rule_tax_rate_id"
|
const taxRateIdIndexName = "IDX_tax_rate_rule_tax_rate_id"
|
||||||
const taxRateIdIndexStatement = createPsqlIndexStatementHelper({
|
const taxRateIdIndexStatement = createPsqlIndexStatementHelper({
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import {
|
|||||||
import TaxRateRule from "./tax-rate-rule"
|
import TaxRateRule from "./tax-rate-rule"
|
||||||
import TaxRegion from "./tax-region"
|
import TaxRegion from "./tax-region"
|
||||||
|
|
||||||
type OptionalTaxRateProps = DAL.SoftDeletableEntityDateColumns
|
type OptionalTaxRateProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const TABLE_NAME = "tax_rate"
|
const TABLE_NAME = "tax_rate"
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import {
|
|||||||
import TaxProvider from "./tax-provider"
|
import TaxProvider from "./tax-provider"
|
||||||
import TaxRate from "./tax-rate"
|
import TaxRate from "./tax-rate"
|
||||||
|
|
||||||
type OptionalTaxRegionProps = DAL.SoftDeletableEntityDateColumns
|
type OptionalTaxRegionProps = DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
const TABLE_NAME = "tax_region"
|
const TABLE_NAME = "tax_region"
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ const inviteDeletedAtIndexStatement = createPsqlIndexStatementHelper({
|
|||||||
type OptionalFields =
|
type OptionalFields =
|
||||||
| "metadata"
|
| "metadata"
|
||||||
| "accepted"
|
| "accepted"
|
||||||
| DAL.SoftDeletableEntityDateColumns
|
| DAL.SoftDeletableModelDateColumns
|
||||||
@Entity({ tableName: "invite" })
|
@Entity({ tableName: "invite" })
|
||||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||||
export default class Invite {
|
export default class Invite {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ type OptionalFields =
|
|||||||
| "last_name"
|
| "last_name"
|
||||||
| "metadata"
|
| "metadata"
|
||||||
| "avatar_url"
|
| "avatar_url"
|
||||||
| DAL.SoftDeletableEntityDateColumns
|
| DAL.SoftDeletableModelDateColumns
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||||
|
|||||||
Reference in New Issue
Block a user