Chore/rm main entity concept (#7709)
**What** Update the `MedusaService` class, factory and types to remove the concept of main modules. The idea being that all method will be explicitly named and suffixes to represent the object you are trying to manipulate. This pr also includes various fixes in different modules Co-authored-by: Stevche Radevski <4820812+sradevski@users.noreply.github.com> Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
2895ccfba8
commit
48963f55ef
@@ -1,2 +1,3 @@
|
||||
export { default as NotificationModel } from "./notification"
|
||||
export { default as Notification } from "./notification"
|
||||
export { default as NotificationProvider } from "./notification-provider"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from "@mikro-orm/core"
|
||||
import NotificationModel from "./notification"
|
||||
import Notification from "./notification"
|
||||
|
||||
@Entity()
|
||||
export default class NotificationProvider {
|
||||
@@ -29,10 +29,10 @@ export default class NotificationProvider {
|
||||
channels: string[]
|
||||
|
||||
@OneToMany({
|
||||
entity: () => NotificationModel,
|
||||
entity: () => Notification,
|
||||
mappedBy: (notification) => notification.provider_id,
|
||||
})
|
||||
notifications = new Collection<NotificationModel>(this)
|
||||
notifications = new Collection<Notification>(this)
|
||||
|
||||
@BeforeCreate()
|
||||
onCreate() {
|
||||
|
||||
@@ -35,7 +35,7 @@ const NotificationReceiverIdIndex = createPsqlIndexStatementHelper({
|
||||
@NotificationReceiverIdIndex.MikroORMIndex()
|
||||
@Entity({ tableName: "notification" })
|
||||
// Since there is a native `Notification` type, we have to call this something else here and in a couple of other places.
|
||||
export default class NotificationModel {
|
||||
export default class Notification {
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
id: string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user