Riqwan Thamir
91faa5ffdb
feat(utils): DML generates foreign key indexes by default ( #7855 )
...
**what:**
- adds default indexes on foreign keys when belongs to relationship is present
RESOLVES CORE-2404
2024-06-27 14:45:27 +00:00
Riqwan Thamir
3f16b011fa
feat(utils,types): DML Index can generate where SQL from a query builder ( #7849 )
...
what:
- introduces a simple query builder
- uses the query builder to tranform an object in where to SQL when applying indexes
```
Examples:
{ where: { column: null } } -> column IS NULL
{ where: { column: { $ne: null } } } -> column IS NOT NULL
{ where: { boolean_column: true } } -> boolean_column IS TRUE
{ where: { column: "value", another_column: { $ne: 30 } } } -> column = "value" AND another_column != 30
```
```
const user = model
.define("user", {
email: model.text(),
account: model.text(),
organization: model.text(),
})
.indexes([
{
on: ["organization", "account"],
where: { email: { $ne: null } },
},
{
name: "IDX-email-account-special",
on: ["organization", "account"],
where: {
email: { $ne: null },
account: null,
},
},
```
RESOLVES CORE-2392
2024-06-27 10:24:34 +00:00
Oli Juhl
b1df20b0dc
fix(inventory): Entity Formulas + softDelete and restore ( #7851 )
2024-06-26 20:51:19 +02:00
Oli Juhl
b5f248f154
fix(region): Soft deleting region unsets region on countries ( #7786 )
...
**What**
Unset `region_id` on countries when soft deleting the associated region. Otherwise, countries cannot be added to new or other regions
Alternatively, we hard delete the region, which will trigger the DB level cascade
In both cases, we cannot easily restore the region countries.
2024-06-26 16:44:16 +00:00
Riqwan Thamir
5ee97d0e97
feat(utils,types): DML can apply composite indexes ( #7842 )
...
**what:**
- DML can apply composite indexes
- Where clause is currently a string, QB version will come as a follow up
```
model.define("user", {
email: model.text(),
account: model.text(),
}).indexes([
{
name: "IDX-unique-name",
unique: true,
on: ["email", "account"],
where: "email is NOT NULL",
},
])
```
RESOLVES CORE-2391
2024-06-26 15:39:04 +00:00
Adrien de Peretti
68dbcda84c
fix: DML Enum property ( #7846 )
...
* fix: DML Enum property
* add more tests
* fix unit tests
2024-06-26 17:01:57 +02:00
Frane Polić
8703f453be
feat(dashboard): manage inventory items for variants ( #7800 )
...
* feat: manage inventory items for variants
* fix: show action only when manage inventory
* fix: translation key
* fix: labels depending on number of items
* fix: address feedback
---------
Co-authored-by: Sebastian Rindom <skrindom@gmail.com >
2024-06-26 11:53:16 +02:00
Riqwan Thamir
4945c79818
feat(utils): infer primaryKeys from a DML model ( #7839 )
...
what:
- depending on other properties in a DML model, we infer primaryKeys between id properties and primaryKey-able properties.
```
Example:
Model 1:
id: model.id() -> primary key
code: model.text()
Model 2:
id: model.id()
code: model.text().primaryKey() -> primary key
Model 3:
id: model.id()
code: model.text().primaryKey() -> composite primary key
name: model.text().primaryKey() -> composite primary key
```
2024-06-26 09:26:09 +00:00
Frane Polić
62dacdda75
fix: refreshing inventory locations list ( #7828 )
2024-06-25 21:19:09 +02:00
Adrien de Peretti
dc307c658d
feat: Add support for array properties DML ( #7836 )
2024-06-25 20:51:14 +02:00
Adrien de Peretti
39038ddb0a
chore: various DML improvements ( #7833 )
...
* chore: various DML improvements
* Check is something through static utils
* Check is something through static utils
* allow to define a schema with table name
* restrict searchable to text only
* rm searchable modifier
* extract constructor logic into separate function
2024-06-25 18:00:39 +02:00
Frane Polić
4a631e789d
feat(dashboard): handle region pricing on create/edit ( #7811 )
...
**What**
- allow for region prices creation on product create flow
- editing of region prices in prices edit form
2024-06-25 15:15:08 +00:00
Riqwan Thamir
bea3e669e1
chore: promotion UI spacing fixes ( #7826 )
2024-06-25 16:50:07 +02:00
Carlos R. L. Rodrigues
61758f374b
chore(medusa): return endpoints ( #7823 )
2024-06-25 13:53:18 +00:00
Carlos R. L. Rodrigues
5600e58b7f
chore(orchestration): idempotent ( #7771 )
2024-06-25 10:34:00 -03:00
Adrien de Peretti
66d17fabde
chore: rename extractor type to InferEntityType ( #7829 )
2024-06-25 13:43:11 +02:00
Frane Polić
11502ee2b5
fix(dashboard): create reservation prefill ( #7820 )
...
**What**
- when creating reservation from inventory details page, preselect that inventory item
FIXES CORE-2387
2024-06-25 06:48:52 +00:00
Adrien de Peretti
34c44078e7
fix: DML relation management for many to one relation ship foreign keys ( #7790 )
...
FIXES CORE-2369
cc @thetutlage
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com >
2024-06-24 18:54:54 +00:00
Oli Juhl
25210369d9
fix(utils): Uppercase event action name ( #7822 )
...
Currently, the keys of the events contain a lowercased action, e.g. `INVENTORY_ITEM_created`, which is breaking our usage across multiple modules
2024-06-24 17:43:49 +00:00
Riqwan Thamir
96fb7a962e
feat(utils,currency): Migrate currency to use DML ( #7807 )
2024-06-24 19:07:26 +02:00
Riqwan Thamir
7414034ac4
chore: scope campaign identifier index with deleted at ( #7821 )
2024-06-24 18:06:14 +02:00
Stevche Radevski
e8d6025374
Add support for tax inclusivity to region and store ( #7808 )
...
This also includes rework of the currency model for the Store module.
This change is breaking as existing stores won't have any supported currencies set, so users would need to go to the store settings again and choose the supported currencies there.
2024-06-24 15:25:44 +00:00
Shahed Nasser
79d90fadc4
feat(utils): configure notification module by default ( #7814 )
...
Add the notification module to `defineConfig` and configure the local notification module.
2024-06-24 14:47:40 +00:00
Adrien de Peretti
021f5ea016
fix: medusa service should infer names when not provided ( #7818 )
...
* fix: medusa service should infer names when not provided
* fix types
* fix typings
2024-06-24 16:35:44 +02:00
Kasper Fabricius Kristensen
aee75f6ba0
feat(dashboard): Add global commands ( #7782 )
...
* add global commands
* update lock
* shorten keybinds
---------
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com >
2024-06-24 13:00:52 +02:00
Adrien de Peretti
27bb93c5b5
chore: Fix export and option of mikro orm define config util ( #7809 )
2024-06-24 09:31:52 +00:00
Riqwan Thamir
5c944ae5d0
feat(types,utils): DML can create a bigNumber property ( #7801 )
...
what:
- adds bigNumber as a property to DML
- creates a bigNumber options field (`raw_{{ field }}`) as a part of the schema
RESOLVES CORE-2375
2024-06-24 08:29:18 +00:00
Adrien de Peretti
ae6dbc06be
chore: Update module test runner to support DmlEntities when needed ( #7799 )
...
* chore: Update module test runner to support DmlEntities when needed
* update es version for core test utils
* fix test
* update swc config
2024-06-24 09:44:01 +02:00
Adrien de Peretti
8fa43a6db3
Feat/define mikro orm configuration dev ( #7798 )
...
* chore: define mikro orm config for CLI
* add tests
* fix types
* fix import
---------
Co-authored-by: Riqwan Thamir <rmthamir@gmail.com >
2024-06-24 09:10:54 +02:00
Riqwan Thamir
8ac74c1357
feat(core-flows,types,pricing,medusa): Products API can create prices with rules ( #7796 )
...
* chore: Products API can create prices with rules
* chore: fix tests
* chore: cleanup
* chore: address comments
2024-06-21 15:30:36 +02:00
Frane Polić
ed104d5aac
fix(dashboard): manage locations for item location levels ( #7794 )
...
* fix: manage locations for item location levels
* fix: toast
2024-06-21 14:43:07 +02:00
Kasper Fabricius Kristensen
e47d8d80d6
fix(dashboard): Fix CSS in Safari ( #7791 )
2024-06-21 14:42:39 +02:00
Harminder Virk
d122b678a8
feat: initialize nullable properties with null value ( #7795 )
2024-06-21 16:41:26 +05:30
Adrien de Peretti
90e6ca0e9e
chore: Internal medusa service proper typings with DML ( #7792 )
2024-06-21 12:36:54 +02:00
Stevche Radevski
944051a951
fix: Allow filtering products by variant options in store ( #7784 )
2024-06-21 10:42:09 +02:00
Stevche Radevski
ee35379e21
chore: Rename all event keys to uppercase ( #7787 )
...
* chore: Rename all event keys to uppercase
* fix: Remove main entity from event builder
2024-06-21 10:41:35 +02:00
Adrien de Peretti
937a632eb6
chore: make module loaders DML aware and auto generate joiner config ( #7781 )
...
* chore: make module loaders DML aware and auto generate joiner config
* fixes and cleanup
* improve dml entity check
* add unit tests on load resources
* cleanup deps
* cleanup deps
* cleanup Modules
* finalise
* fix modules-sdk jest
* fix modules-sdk jest
* fix import
* fix import
2024-06-20 18:18:07 +02:00
Riqwan Thamir
03924a4ff6
chore: move to swc/jest ( #7739 )
...
* chore: move to swc
* chore: fix tax rate tests
* chore: undo failed test
* chore: fix unit tests script
* chore: use node 20
* Update scripts/run-workspace-unit-tests-in-chunks.sh
2024-06-20 12:59:33 +02:00
Riqwan Thamir
f61557712c
chore: make apis nullable ( #7763 )
...
what:
- makes top level attributes of each object an optional field in the http layer where possible
RESOLVES CORE-2229
2024-06-20 10:10:59 +00:00
Riqwan Thamir
33c4cd34cc
chore: export DML builders + fix default undefined values in SQL ( #7776 )
...
* chore: export dml builders through utils
* chore: fix undefined sql error
* chore: upgrade to ts 5
* chore: use isDefined
2024-06-20 10:45:49 +02:00
Harminder Virk
45ad70e96b
Add support for pivot table and entity in manyToMany relationships ( #7779 )
2024-06-20 14:13:31 +05:30
Frane Polić
79a8f0ef2c
feat(dashboard): move shipping profile to locations ( #7777 )
2024-06-20 06:47:40 +00:00
Adrien de Peretti
48963f55ef
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 >
2024-06-19 13:02:16 +00:00
Harminder Virk
2895ccfba8
Add support for id property type ( #7775 )
2024-06-19 17:59:03 +05:30
Frane Polić
ef5719a3d8
feat(dashboard): variant details page ( #7767 )
...
* wip: setup
* feat: finish inventory, prices section
* feat: finish prices section pagination
* fix: move edit variants to variants details, fix loader
* fix: suggestion
* feat: price editor flow
2024-06-19 13:56:35 +02:00
Harminder Virk
fd87858bd9
Handle embedded pg schema name inside the table name when generating indexes ( #7774 )
2024-06-19 16:48:44 +05:30
Harminder Virk
0b623fa27a
Allow entities to contain pg schema name in their name ( #7773 )
2024-06-19 14:39:33 +05:30
Oli Juhl
305e1d66ca
fix(medusa): Load subscribers and scheduled jobs in worker mode ( #7769 )
2024-06-18 19:15:55 +02:00
Riqwan Thamir
0d04c548f5
feat(dashboard,types,promotion,medusa): hide fields on promotions depending on templates ( #7746 )
...
**what:**
- hides different fields depending on the chosen template
- remove operator values API
- fixes to edit promotion rules
- make currency optional for promotion
RESOLVES CORE-2297
2024-06-18 16:47:42 +00:00
Harminder Virk
1451112f08
Add support for created and updated at timestamps ( #7765 )
2024-06-18 21:22:31 +05:30