-
Notifications
You must be signed in to change notification settings - Fork 0
SSF-135 - admin order management changes #121
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
|
||
| export class AddAssigneeToOrders1773009000618 implements MigrationInterface { | ||
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(` | ||
| ALTER TABLE orders | ||
| ADD COLUMN assignee_id INT, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that asignees should not be able to be nullable
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since there isn't an order creation workflow yet, i think it might be best to keep it nullable for now and change it later once that's implemented. the existing orders currently have null assignees so it might break things There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Yurika-Kan what do you think? I don't think it will break anything since the null assignees are new here but will defer to your judgement |
||
| ADD CONSTRAINT fk_assignee_id | ||
| FOREIGN KEY (assignee_id) REFERENCES users(user_id) ON DELETE SET NULL | ||
| `); | ||
| } | ||
|
|
||
| public async down(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(` | ||
| ALTER TABLE orders | ||
| DROP CONSTRAINT IF EXISTS fk_assignee_id, | ||
| DROP COLUMN assignee_id | ||
| `); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ import { FoodRequest } from '../foodRequests/request.entity'; | |
| import { FoodManufacturer } from '../foodManufacturers/manufacturers.entity'; | ||
| import { OrderStatus } from './types'; | ||
| import { Allocation } from '../allocations/allocations.entity'; | ||
| import { User } from '../users/user.entity'; | ||
|
|
||
| @Entity('orders') | ||
| export class Order { | ||
|
|
@@ -95,4 +96,8 @@ export class Order { | |
| nullable: true, | ||
| }) | ||
| shippingCost!: number | null; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see the relation but we should add an explicity assignee_id column definition to this entity since we add a table column |
||
| @ManyToOne(() => User, { nullable: true }) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should not be nullable |
||
| @JoinColumn({ name: 'assignee_id', referencedColumnName: 'id' }) | ||
| assignee!: User | null; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove | null |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -664,7 +664,7 @@ const OrderStatusSection: React.FC<OrderStatusSectionProps> = ({ | |
| alignItems="center" | ||
| justifyContent="center" | ||
| > | ||
| {volunteers && volunteers.length > 0 ? ( | ||
| {order.assignee ? ( | ||
| <Box | ||
| key={index} | ||
| borderRadius="full" | ||
|
|
@@ -677,9 +677,8 @@ const OrderStatusSection: React.FC<OrderStatusSectionProps> = ({ | |
| color="white" | ||
| p={2} | ||
| > | ||
| {/* TODO: Change logic later to only get one volunteer */} | ||
| {volunteers[0].firstName.charAt(0).toUpperCase()} | ||
| {volunteers[0].lastName.charAt(0).toUpperCase()} | ||
| {order.assignee?.firstName.charAt(0).toUpperCase()} | ||
| {order.assignee?.lastName.charAt(0).toUpperCase()} | ||
| </Box> | ||
| ) : ( | ||
| <Box>No Assignees</Box> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can remove the no assignee case |
||
|
|
@@ -706,7 +705,7 @@ const OrderStatusSection: React.FC<OrderStatusSectionProps> = ({ | |
| <Table.Cell | ||
| {...tableCellStyles} | ||
| textAlign="left" | ||
| color="neutral.700" | ||
| bg="#FAFAFA" | ||
| > | ||
| {/* TODO: IMPLEMENT WHAT GOES HERE */} | ||
| </Table.Cell> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -361,6 +361,11 @@ export interface OrderSummary { | |
| }[]; | ||
| }; | ||
| }; | ||
| assignee: { | ||
| id: number; | ||
| firstName: string; | ||
| lastName: string; | ||
| } | null; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove | null |
||
| } | ||
|
|
||
| export enum ApplicationStatus { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here we can edit the dummy data to add ids for the asignee for each order