Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Warehouse identifier for orders and users #100

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

cgsmith
Copy link
Contributor

@cgsmith cgsmith commented Dec 30, 2022

This addresses the issue #98

Users will either be associated with customers or warehouses. This way a warehouse user can see all customers that have orders with 'Warehouse 1' and customers can have multiple fulfillment centers. This also allows us to send requests upstream to the warehouses when modifications or cancellations are required.

  • Create warehouse model
  • Allow users to be associated with warehouse
  • Allow limiting API key by warehouse
  • Allow limiting orders by warehouse identifier
  • Investigate and see if users can make changes to warehouse on the order (not sure on this?)
  • Test to make sure deleting a warehouse does not delete any orders. Should be restricted or null on foreign key constraint

** Accidentally created a PR as open instead of draft.

@cgsmith cgsmith added the enhancement New feature or request label Dec 30, 2022
@cgsmith cgsmith requested review from samdark and cdwieber December 30, 2022 21:35
Copy link
Contributor

@cdwieber cdwieber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is with great pleasure that I approve these additions.

@cgsmith
Copy link
Contributor Author

cgsmith commented Dec 30, 2022

@cdwieber it's missing a few features at the moment lol.

*/
public static function getList($keyField = 'id', $valueField = 'name')
{
$data = self::find()->orderBy([$valueField => SORT_ASC])->all();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How many warehouses are going to be in the database?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially it'll only be about 10 or so.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it will grow big, this solution won't work.

$this->createTable('{{%user_warehouse}}', [
'id' => $this->primaryKey(),
'warehouse_id' => $this->integer()->notNull(),
'user_id' => $this->integer()->notNull(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we define foreign keys for these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I'll get that added.

@@ -60,6 +60,15 @@
<?= $form->field($model->order, 'customer_id')
->dropdownList($customers, ['prompt' => ' Please select']) ?>


<?php
// i think i only want this for admins right now... needs more thought
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: resolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants