Created
December 29, 2022 18:52
-
-
Save adevinwild/b3e698c37f110210126e45fe0cfb5b26 to your computer and use it in GitHub Desktop.
ExtenderUserEntity for Medusa.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { User as MedusaUser } from "@medusajs/medusa/dist"; | |
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm"; | |
import { Entity as MedusaEntity } from "medusa-extender"; | |
import { Store } from "../../store/entities/store.entity"; | |
@MedusaEntity({ override: MedusaUser }) | |
@Entity() | |
export class User extends MedusaUser { | |
@Index() | |
@Column({ nullable: true, type: "text" }) | |
store_id: string; | |
@ManyToOne(() => Store, (store) => store.members, { nullable: true }) | |
@JoinColumn({ name: "store_id", referencedColumnName: "id" }) | |
store: Store; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment