Skip to content

Commit

Permalink
feat(storefront): ✨ added order tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
sahrohit committed Sep 13, 2023
1 parent 4a8c883 commit e945c5b
Show file tree
Hide file tree
Showing 9 changed files with 418 additions and 20 deletions.
5 changes: 5 additions & 0 deletions apps/admin/src/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ export type Query = {
roles: Array<UserRole>;
searchProducts?: Maybe<Array<Product>>;
shippingmethods: Array<ShippingMethod>;
trackById?: Maybe<OrderDetail>;
variants: Array<Variant>;
};

Expand Down Expand Up @@ -627,6 +628,10 @@ export type QuerySearchProductsArgs = {
query: Scalars["String"];
};

export type QueryTrackByIdArgs = {
orderId: Scalars["String"];
};

export type RegisterInput = {
email: Scalars["String"];
first_name: Scalars["String"];
Expand Down
14 changes: 14 additions & 0 deletions apps/api/src/resolvers/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,20 @@ export class OrderResolver {
});
}

@Query(() => OrderDetail, { nullable: true })
trackById(
@Arg("orderId", () => String) orderId: string,
@Ctx() { req }: MyContext
): Promise<OrderDetail | null> {
return OrderDetail.findOne({
relations: {
address: true,
paymentdetails: true,
},
where: { userId: req.session.userId, id: orderId },
});
}

@Mutation(() => OrderDetail)
@UseMiddleware(isVerified)
async createOrder(
Expand Down
41 changes: 41 additions & 0 deletions apps/storefront/public/assets/bored.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

2 comments on commit e945c5b

@vercel
Copy link

@vercel vercel bot commented on e945c5b Sep 13, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

ecommerce-admin-client – ./apps/admin

ecommerce-admin-client.vercel.app
ecommerce-admin-client-git-main-sahrohit.vercel.app
ecommerce-admin-client-sahrohit.vercel.app

@vercel
Copy link

@vercel vercel bot commented on e945c5b Sep 13, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.