Commit Graph

18 Commits

Author SHA1 Message Date
David Preininger
2caff2efc7 feat(medusa): Authentication overhaul (#4064)
* implemented bearer auth

* changed naming strat

* changed session auth to not use jwt

* typo

* changed auth header prefix for admin api token auth

* fixed supporting functions to work with new session type

* removed database calls for bearer auth improving performance

* removed unused deps

* changed auth in tests

* added integration tests

* Accepted suggested change

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

* Typo

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* more typos

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* proper formatting

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* removed endregion

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* removed startregion

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* fixed admin JWT integration test

* added more fixes to integration tests

* Update OAS

* Create fluffy-donkeys-hope.md

* created API reference for new auth

* implemented getToken in medusa-js

* Apply suggestions from code review

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>

* Apply suggestions from code review

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>

* deleted files which should be autogenerated

* Update fluffy-donkeys-hope.md

* JSDoc update

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>

* added missing route exports

* implemented runtime domain safety in jwt token manager

* fixed jwt manager

* lint get-token files

* Update fluffy-donkeys-hope.md

* Revert "deleted files which should be autogenerated"

This reverts commit cd5e86623b822e6a6ac37322b952143ccc493df9.

* Revert "Apply suggestions from code review"

This reverts commit f02f07ce58fd9fcc2dfc80cadbb9df2665108d65.

* Revert "created API reference for new auth"

This reverts commit c9eafbb36453f5cf8047c79e94f470cb2d023c7d.

* renamed header for sending api access tokens

* medusa-js - changed apiKey header

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: olivermrbl <oliver@mrbltech.com>
Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
2023-09-25 13:57:44 -04:00
Adrien de Peretti
4d326fbbdf chore: Move factories and helpers to a better place (#4551)
* chore: Move factories and helpers to a better place

* align factory product variant

* fix factory cart

* add simple store fac

* fix tests

* fix tests

* fix

* fix cart seeder
2023-07-20 13:16:04 +02:00
Philip Korsholm
c16522d6ce feat(medusa): Add has_account to list-customers query params (#2811) 2022-12-16 12:16:34 +01:00
Carlos R. L. Rodrigues
ffd6234356 chore(integration): throw errors on catch blocks (#2091)
Why:
Suppressing errors and not failing the execution will lead to misleading errors of the following tests.

Fixes CORE-461
2022-08-25 06:36:24 +00:00
Philip Korsholm
dacc9c6c4b Feat: Add groups to list customer (#1113)
* add controllers directory and loaders

* update integration tests

* start groups

* move controllers to pure functions

* group filtering for customers

* print errors

* remove verbose flag

* controller refactor

* update imports

* Feat/list customers by customer group (#1114)

* move controllers to pure functions

* add customer group test

* add api for list customer group customers

* remove unused imports

* controller refactor

* update imports

* Update packages/medusa/src/api/routes/admin/customer-groups/get-customer-group-customers.ts

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* fix: dedupe

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
2022-03-10 13:05:46 +01:00
Frane Polić
a514d84ccf feat: list customer groups (#1099) 2022-03-02 11:38:44 +01:00
Philip Korsholm
4b4463f0e2 Feat: Bulk add customers to customer group (#1095)
* fix babel transform-runtime regenerator required for migrations

* add customer group model

* add migration for customer group

* add customer group model export

* add customer group repository

* add customer group service

* add CustomerGroupRepository to "withTransaction" in CustomerGroupService

* remove unnecessary argument to runtime plugin

* service export ordering

* add create customer group endpoint

* add customergroup to route index in admin

* add customer group service

* add customer groups test

* cleanup

* add customers batch initial

* batch creation of customer groups

* integration testing batch creation

* integration tests

* chaining existing customers creation in repo

* remove commented test

* update unit tests to reflect change in idempotent behavior

* ensure that exceptions are expected

* update idempotency behavior

* update formatting

* update format

* Update packages/medusa/src/repositories/customer-group.ts

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* pr feedback

* add In import

* add seperate model dto

* add integration test

* error handling in repository

* remove unused import

* jsdoc

* Update packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* Update packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* pr review comments

* rename variable

* fix: adds atomic phase clean up callback

* fix: call error handler in new transaction block too

* restore

* error handling

* fix: error handler in no isolation case

* add integration test for missing group on update

* final adjustments to test

* fix pr feedback

* cleanup core for pr

* remove console.log

* remove customergroupservice test from customers

* Apply suggestions from code review

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* add end bracket to customer tests

* remove comments

* change model decorator

* fix integration test merge

* onDelete cascade instead of cascade:true

* remove verbose flag

* fix: dedupe type

* add save to customer groups

* customer model delete cascade

* add await to asyncronous save operations

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
2022-02-28 10:03:26 +01:00
Philip Korsholm
0394be36ef Feat: bulk delete customers from customer group (#1097)
* integration testing

* customer seeder

* initial bulk removal

* integraiton testing of deletes

* delete fix

* not found test

* remove unused code

* Apply suggestions from code review

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* update integration tests

* pr review fixes

* update migration

* formatting

* integration tests for deletion

* pr feedback

* fix failing integration tests

* remove integration tests before merging

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
2022-02-25 15:29:13 +01:00
Philip Korsholm
e35a4fb2ea Feat: Delete customer group (#1102) 2022-02-24 14:20:58 +01:00
Frane Polić
75fb2ce9c3 feat: update customer groups (#1075)
* update customer service prep

* expand on the update customer groups test case

* add the test case for customer group update

* docs for `groups` prop on update customer endpoint

* refactor, update comments

* expend on integration tests, add customer mock with a group

* refactor to use `customerGroupService.list` method

* update units

* remove `updateCustomerGroups`

* fix rebase conflict

* fix customer seed data, add JoinTable on groups

* group retrieval using the expand param

* fix: use `buildQuery_`

* fix: validation for `groups`, enable `expand`param on update customer endpoint

* fix: remove fileds form the `FilterableCustomerGroupProps`

* fix: spearate body/query validation

Co-authored-by: fPolic <frane@medusajs.com>
2022-02-21 16:24:38 +01:00
Oliver Windall Juhl
9f4a9f7db4 Add expand to /admin/customers/:id (#1070)
* fix: 1055 add expand to /admin/customers/:id

* fix tests

* fix tests
2022-02-16 23:41:30 +01:00
Derek Wene
ebb7c0aa53 Fix: admin api create customer (#826) 2021-11-20 11:50:28 +01:00
Derek Wene
2d9879ea09 feat: admin api - allow customers to be created and updated with metadata (#824)
* feat: admin api - allow customers to be created and updated with metadata

* feat: add integration test for metadata
2021-11-18 18:50:36 +01:00
Oliver Windall Juhl
373532ecbc feat: Typescript for API layer (#817)
Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
Co-authored-by: Zakaria El Asri <33696020+zakariaelas@users.noreply.github.com>
Co-authored-by: Kasper Fabricius Kristensen <45367945+kasperkristensen@users.noreply.github.com>
Co-authored-by: Philip Korsholm <philip.korsholm@hotmail.com>
Co-authored-by: Sebastian Rindom <seb@medusa-commerce.com>
2021-11-18 15:19:17 +01:00
Sebastian Mateos Nicolajsen
a70e3ed0ae feat: customer-information (#413)
* added the ability to update email as long as user has_account=false

* revamped and added fix for MC-132

Co-authored-by: olivermrbl <oliver@mrbltech.com>
2021-09-23 10:22:18 +02:00
Zakaria El Asri
49a132976d fix: ILIKE operator not supported in sqlite (#393)
* fix: replace ILIKE operator with ILike function where possible

* remove: unused import

* fix: remove alias from test case as it is not needed

* fix: product variant query

* add: integration tests + fallback to original query for all queries searching on the display_id field

* remove: console.log
2021-09-21 11:15:33 +02:00
Sebastian Rindom
9a701ff229 fix: improves integration tests (#332)
* fix: improves integration tests

* fix: giftcard order with total 0

* fix: remove breaking eager
2021-08-11 09:26:25 +02:00
Oliver Windall Juhl
22be418ec1 fix(medusa): Add querying func. on customer retrievals (#181) 2021-02-23 13:40:49 +01:00