Skip to content

Commit

Permalink
Merge pull request #154 from WildCodeSchool/feature/131/order-article…
Browse files Browse the repository at this point in the history
…s-in-admin-dashboard

order articles by product in dashboard admin
  • Loading branch information
AntoniSDev authored Dec 13, 2024
2 parents 9e9a31b + af23883 commit 51734ac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion backend/src/resolvers/ArticleResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class NewArticleInput {
class ArticleResolver {
@Query(() => [Article])
async getAllArticles() {
const article = await Article.find({ relations: { product: true, reservations: true } })
const article = await Article.find({ relations: { product: true, reservations: true }, order: { product: {name: "ASC" }}
})
return article
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ArticleReservationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const ArticleReservationCard = ({
return (
<>
{reservationData.reservation.status === "pending" ? (
<Card title={`Détails de votre réservation`} style={{ width: 500 }}>
<Card title={"Détails de votre réservation"} style={{ width: 500 }}>
{articles.map((article) => (
<Card style={{ margin: 20 }} key={article.product?.id}>
<div
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/CancelReservationButton.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useMutation } from "@apollo/client";
import { Button, message, Popconfirm } from "antd";
import { CANCEL_RESERVATION } from "../graphql/mutations";
import { Reservation } from "../interface/types";
import { ReservationData } from "../interface/types";
import {
GetCurrentReservationByUserIdDocument,
GetReservationsByUserIdDocument,
} from "../generated/graphql-types";

function CancelReservationButton({ reservation }: Reservation) {
function CancelReservationButton({ reservation }: ReservationData) {
const [cancelReservation] = useMutation(CANCEL_RESERVATION, {
onCompleted: () => {
message.success("La réservation a bien été annulée.");
Expand Down

0 comments on commit 51734ac

Please sign in to comment.