Skip to content

Commit

Permalink
feat(TransactionsImports): Add note on rows (#10660)
Browse files Browse the repository at this point in the history
  • Loading branch information
Betree authored Jan 30, 2025
1 parent e00cf4d commit 8bab229
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 0 deletions.
14 changes: 14 additions & 0 deletions migrations/20250123000000-add-note-to-transactions-import-row.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn('TransactionsImportsRows', 'note', {
type: Sequelize.TEXT,
allowNull: true,
});
},

down: async queryInterface => {
await queryInterface.removeColumn('TransactionsImportsRows', 'note');
},
};
10 changes: 10 additions & 0 deletions server/graphql/schemaV2.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7203,6 +7203,11 @@ type TransactionsImportRow {
"""
amount: Amount!

"""
Optional note for the row
"""
note: String

"""
The expense associated with the row
"""
Expand Down Expand Up @@ -23168,6 +23173,11 @@ input TransactionsImportRowUpdateInput {
The expense associated with the row
"""
expense: ExpenseReferenceInput

"""
Optional note for the row
"""
note: String
}

"""
Expand Down
5 changes: 5 additions & 0 deletions server/graphql/v2/input/TransactionsImportRowUpdateInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type TransactionImportRowGraphQLType = {
isDismissed?: boolean | null;
order?: OrderReferenceInputGraphQLType | null;
expense: ExpenseReferenceInputFields | null;
note?: string | null;
};

export const GraphQLTransactionsImportRowUpdateInput = new GraphQLInputObjectType({
Expand Down Expand Up @@ -52,5 +53,9 @@ export const GraphQLTransactionsImportRowUpdateInput = new GraphQLInputObjectTyp
type: GraphQLExpenseReferenceInput,
description: 'The expense associated with the row',
},
note: {
type: GraphQLString,
description: 'Optional note for the row',
},
}),
});
1 change: 1 addition & 0 deletions server/graphql/v2/mutation/TransactionImportsMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ const transactionImportsMutations = {
'sourceId',
'description',
'date',
'note',
]);
if (row.amount) {
values.amount = getValueInCentsFromAmountInput(row.amount);
Expand Down
4 changes: 4 additions & 0 deletions server/graphql/v2/object/TransactionsImportRow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ export const GraphQLTransactionsImportRow = new GraphQLObjectType({
description: 'The amount of the row',
resolve: (row: TransactionsImportRow) => ({ value: row.amount, currency: row.currency }),
},
note: {
type: GraphQLString,
description: 'Optional note for the row',
},
expense: {
type: GraphQLExpense,
description: 'The expense associated with the row',
Expand Down
8 changes: 8 additions & 0 deletions server/models/TransactionsImportRow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class TransactionsImportRow extends Model<
declare public isUnique: boolean;
declare public currency: SupportedCurrency;
declare public rawValue: Record<string, string>;
declare public note: string | null;
declare public createdAt: Date;
declare public updatedAt: Date;
declare public deletedAt: Date | null;
Expand Down Expand Up @@ -109,6 +110,13 @@ TransactionsImportRow.init(
type: DataTypes.JSONB,
allowNull: true,
},
note: {
type: DataTypes.TEXT,
allowNull: true,
validate: {
len: [0, 5000],
},
},
createdAt: {
type: DataTypes.DATE,
allowNull: false,
Expand Down

0 comments on commit 8bab229

Please sign in to comment.