Files
medusa-store/integration-tests/helpers/user-seeder.js
Philip Korsholm 5d10c46bb1 feat(medusa): Separate money amount and variant (#4906)
* initial changes

* working test

* final changes to product tests

* update integration tests

* update price list integration tests

* update integration tests

* update unit tests

* update plugin integration tests

* remove catch from integration test

* undo change

* add andWhere

* update upsertCurrencyMoneyAmount method

* undo line item changes

* undo changes

* update deprecated method

* Update packages/medusa/src/migrations/1692953518123-drop_money_amount_constraints_for_pricing_module.ts

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>

* rename joinTable

* update with joinTable entity

* update load methods

* remove await create

* re-add context test

* update price list behavior for prices

* update price list snapshots

* re-add admin seeder

* pr feedback

* fix unit tests

* fix plugin integration tests

* initial review changes

* redo changes to variant creation

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-09-13 13:26:20 +02:00

54 lines
1.2 KiB
JavaScript

const { User, Invite } = require("@medusajs/medusa")
import jwt from "jsonwebtoken"
const generateToken = (data) => {
return jwt.sign(data, "test", {
expiresIn: "7d",
})
}
const expires_at = new Date()
expires_at.setDate(expires_at.getDate() + 8)
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
const memberUser = manager.create(User, {
id: "member-user",
role: "member",
email: "member@test.com",
first_name: "member",
last_name: "user",
})
await manager.save(memberUser)
const memberInvite = manager.create(Invite, {
id: "memberInvite",
user_email: "invite-member@test.com",
role: "member",
token: generateToken({
invite_id: "memberInvite",
role: "member",
user_email: "invite-member@test.com",
}),
accepted: false,
expires_at: expires_at,
})
await manager.save(memberInvite)
const adminInvite = manager.create(Invite, {
id: "adminInvite",
user_email: "invite-admin@test.com",
role: "admin",
accepted: false,
token: generateToken({
invite_id: "adminInvite",
role: "admin",
user_email: "invite-admin@test.com",
}),
expires_at: expires_at,
})
await manager.save(adminInvite)
}