Skip to content

Commit

Permalink
Merge pull request #30
Browse files Browse the repository at this point in the history
* Add functionality to modify board view state

* Refactor KanbanBoard component, remove unnecessary code

* Refactor 'boards' resolver to shared function

* Refactor board index resolver file

* Update to transactions for database interactions

* Remove commented code in issue resolver

* Refactor import orders in KanbanBoard components

* Remove unnecessary comments from index.tsx

* Add 'AddItemToViewState' mutation to graphql

* Implement row level locking for container items reordering

* Disable data pre-loading and refetching

* Add refetch to onCompleted in KanbanBoard

* Refactor Kanban board's issue status update logic

* Update issue status and ensure data consistency

* Add version field to board table

* Update board version on item addition

* Refactor Kanban board code to improve readability
  • Loading branch information
claygorman authored Jan 17, 2024
1 parent 751b93b commit fbb601f
Show file tree
Hide file tree
Showing 26 changed files with 1,105 additions and 445 deletions.
4 changes: 2 additions & 2 deletions backend/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const config: CodegenConfig = {
},
hooks: {
afterOneFileWrite: [
"sed -i '' 's/import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from '\\''graphql'\\'';/import type { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from '\\''graphql'\\'';/g' src/__generated__/resolvers-types.ts\n",
"sed -i '' 's/import { ApolloContext } from '\\''..\\/server\\/apollo.js'\\'';/import type { ApolloContext } from '\\''..\\/server\\/apollo.js'\\'';/g' src/__generated__/resolvers-types.ts\n",
// "sed -i '' 's/import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from '\\''graphql'\\'';/import type { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from '\\''graphql'\\'';/g' src/__generated__/resolvers-types.ts",
// "sed -i '' 's/import { ApolloContext } from '\\''..\\/server\\/apollo.js'\\'';/import type { ApolloContext } from '\\''..\\/server\\/apollo.js'\\'';/g' src/__generated__/resolvers-types.ts",
],
},
config: {
Expand Down
1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@graphql-tools/merge": "^9.0.1",
"@hocuspocus/extension-database": "^2.8.1",
"@hocuspocus/server": "^2.8.1",
"array-move": "^4.0.0",
"axios": "^1.6.0",
"dataloader-sequelize": "^2.3.3",
"fastify": "^4.25.2",
Expand Down
8 changes: 8 additions & 0 deletions backend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 61 additions & 2 deletions backend/src/__generated__/resolvers-types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 112 additions & 0 deletions backend/src/db/migrations/20240113143058-create-board-item-tables.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
'use strict';

const CONTAINER_TABLE_NAME = 'board_containers';
const ITEMS_TABLE_NAME = 'container_items';

/** @type {import('sequelize-cli').Migration} */
export default {
async up(queryInterface, Sequelize) {
await queryInterface.createTable(CONTAINER_TABLE_NAME, {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER,
},
boardId: {
type: Sequelize.INTEGER,
field: 'board_id',
references: {
model: {
tableName: 'boards',
schema: 'public',
},
key: 'id',
},
},
title: {
type: Sequelize.STRING,
field: 'title',
},
position: {
type: Sequelize.INTEGER,
field: 'position',
},
createdAt: {
field: 'created_at',
type: Sequelize.DATE,
},
updatedAt: {
field: 'updated_at',
type: Sequelize.DATE,
},
});

await queryInterface.addIndex(CONTAINER_TABLE_NAME, {
fields: ['board_id'],
unique: false,
});

await queryInterface.createTable(ITEMS_TABLE_NAME, {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER,
},
issueId: {
type: Sequelize.INTEGER,
field: 'issue_id',
references: {
model: {
tableName: 'issues',
schema: 'public',
},
key: 'id',
},
},
containerId: {
type: Sequelize.INTEGER,
field: 'container_id',
references: {
model: {
tableName: CONTAINER_TABLE_NAME,
schema: 'public',
},
key: 'id',
},
},
position: {
type: Sequelize.INTEGER,
field: 'position',
},
createdAt: {
field: 'created_at',
type: Sequelize.DATE,
},
updatedAt: {
field: 'updated_at',
type: Sequelize.DATE,
},
});

await queryInterface.addIndex(ITEMS_TABLE_NAME, {
fields: ['container_id'],
unique: false,
});

await queryInterface.addIndex(ITEMS_TABLE_NAME, {
fields: ['issue_id'],
unique: false,
});

await queryInterface.addIndex(ITEMS_TABLE_NAME, {
fields: ['container_id', 'issue_id'],
unique: true,
});
},
async down(queryInterface, Sequelize) {
await queryInterface.dropTable(CONTAINER_TABLE_NAME);
await queryInterface.dropTable(ITEMS_TABLE_NAME);
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const TABLE_NAME = 'boards';

/** @type {import('sequelize-cli').Migration} */
export default {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn(TABLE_NAME, 'version', {
type: Sequelize.INTEGER,
allowNull: false,
defaultValue: 1,
});
},
async down(queryInterface, Sequelize) {
await queryInterface.removeColumn(TABLE_NAME, 'version');
},
};
Loading

0 comments on commit fbb601f

Please sign in to comment.