Skip to content

Commit

Permalink
Merge pull request #229 from aXenDeveloper/refactor/drag_and_drop_table
Browse files Browse the repository at this point in the history
refactor(frontend): Improve drag and drop hook
  • Loading branch information
aXenDeveloper authored Feb 25, 2024
2 parents 467a829 + 1d26325 commit d4bc46a
Show file tree
Hide file tree
Showing 15 changed files with 479 additions and 417 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export class ChangePositionForumForumsService {
const allChildrenParent =
await this.databaseService.db.query.forum_forums.findMany({
where: (table, { eq }) =>
parent_id === null
? isNull(table.parent_id)
!parent_id
? isNull(table.parent_id ?? null)
: eq(table.parent_id, parent_id),
orderBy: (table, { asc }) => asc(table.position)
});
Expand Down
8 changes: 4 additions & 4 deletions backend/src/forum/forums/show/dto/show.obj.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ export class FirstShowForumForums extends ShowForumForums {

@ObjectType()
export class ChildrenShowForumForums extends ShowForumForums {
@Field(() => [LastChildShowForumForums], { nullable: true })
children: LastChildShowForumForums[] | null;
@Field(() => [LastChildShowForumForums])
children: LastChildShowForumForums[];
}

@ObjectType()
export class ShowForumForumsWithParent extends FirstShowForumForums {
@Field(() => ShowForumForums, { nullable: true })
parent: ShowForumForums | null;

@Field(() => [ChildrenShowForumForums], { nullable: true })
children: ChildrenShowForumForums[] | null;
@Field(() => [ChildrenShowForumForums])
children: ChildrenShowForumForums[];
}

@ObjectType()
Expand Down
8 changes: 4 additions & 4 deletions backend/src/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type AvatarUser {

type ChildrenShowForumForums {
_count: ShowForumForumsCount!
children: [LastChildShowForumForums!]
children: [LastChildShowForumForums!]!
created: Int!
description: [TextLanguage!]!
id: Int!
Expand All @@ -44,7 +44,7 @@ type ChildrenShowForumForums {

type CreateForumForumsObj {
_count: ShowForumForumsCount!
children: [ChildrenShowForumForums!]
children: [ChildrenShowForumForums!]!
created: Int!
description: [TextLanguage!]!
id: Int!
Expand Down Expand Up @@ -438,7 +438,7 @@ type ShowForumForums {

type ShowForumForumsAdmin {
_count: ShowForumForumsCount!
children: [ChildrenShowForumForums!]
children: [ChildrenShowForumForums!]!
created: Int!
description: [TextLanguage!]!
id: Int!
Expand All @@ -463,7 +463,7 @@ type ShowForumForumsObj {

type ShowForumForumsWithParent {
_count: ShowForumForumsCount!
children: [ChildrenShowForumForums!]
children: [ChildrenShowForumForums!]!
created: Int!
description: [TextLanguage!]!
id: Int!
Expand Down
5 changes: 3 additions & 2 deletions frontend/admin/forum/views/forums/forums-forum-admin-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { useTranslations } from "next-intl";
import { HeaderContent } from "@/components/header-content/header-content";
import { ActionsForumsForumAdmin } from "./actions/actions";
import { TableForumsForumAdmin } from "./table/table";
import type { Admin__Forum_Forums__ShowQuery } from "@/graphql/hooks";

export const ForumsForumAdminView = () => {
export const ForumsForumAdminView = (props: Admin__Forum_Forums__ShowQuery) => {
const t = useTranslations("admin.forum.forums");

return (
Expand All @@ -13,7 +14,7 @@ export const ForumsForumAdminView = () => {
<ActionsForumsForumAdmin />
</HeaderContent>

<TableForumsForumAdmin />
<TableForumsForumAdmin {...props} />
</>
);
};
Loading

0 comments on commit d4bc46a

Please sign in to comment.