Skip to content

Commit

Permalink
Add balance field to account
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-bach committed Jan 1, 2025
1 parent 2ff08c1 commit bdd701e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 8 deletions.
13 changes: 5 additions & 8 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,17 @@ X Switch to sonner
X Add tests to validate APIs and workflows
X Switch frontend to use NextJS 14 with turbo
X Switch transactionsResolver to use AppSync JS pipeline resolvers
X Rearchitect updatePositions/updateBalances to use AppSync JS Resolvers

##### Current Task

X Rearchitect updatePositions/updateBalances to use AppSync JS Resolvers
X BUG: Creates multiple symbols in drop down
X Ensure updatePositions updates on investment transactions create/update

- Create updateBalances updates on bank transactions create/update
- simulate failure in updatePosition Lambda to ensure it goes to DLQ (i.e. set the pk to undefined L133)
- add tests to updatePosition Lambda
- Update dashboard to pull positions and totals - requires new API getPositions(userId)
- On PositionUpdatedEvent, update account balance with Position.marketvalue
- On BankTransactionSavedEvent, update account balance with Transaction.amount

##### Future Task

- add tests to updatePosition Lambda
- Update dashboard to pull positions and totals - requires new API getPositions(userId)
- create L3 constructs for AppSync CDK
- Update to nodejs 22
- Frontend - remove "Loading..." on screens, remove landing page for login page, improvements to FE
Expand Down
1 change: 1 addition & 0 deletions backend/src/appsync/Mutation.createAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function request(ctx: Context<MutationCreateAccountArgs>): DynamoDBPutIte
category: util.dynamodb.toDynamoDB(ctx.args.input.category),
type: util.dynamodb.toDynamoDB(ctx.args.input.type),
name: util.dynamodb.toDynamoDB(ctx.args.input.name),
balance: util.dynamodb.toDynamoDB(0),
userId: util.dynamodb.toDynamoDB((ctx.identity as AppSyncIdentityCognito).username),
createdAt: util.dynamodb.toDynamoDB(datetime),
updatedAt: util.dynamodb.toDynamoDB(datetime),
Expand Down
1 change: 1 addition & 0 deletions backend/src/appsync/api/codegen/appsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export type Scalars = {
export type Account = {
__typename?: 'Account';
accountId: Scalars['ID']['output'];
balance: Scalars['Float']['output'];
category: Scalars['String']['output'];
createdAt: Scalars['AWSDateTime']['output'];
entity: Scalars['String']['output'];
Expand Down
1 change: 1 addition & 0 deletions backend/src/appsync/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ type Account {
category: String!
type: String!
name: String!
balance: Float!
userId: String!
createdAt: AWSDateTime!
updatedAt: AWSDateTime!
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/actions/api/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const createAccount = `mutation CreateAccount($input: CreateAccountInput!
name
category
type
balance
createdAt
updatedAt
}
Expand All @@ -47,6 +48,7 @@ export const updateAccount = `mutation UpdateAccount($input: UpdateAccountInput!
name
type
entity
balance
createdAt
updatedAt
}
Expand All @@ -59,6 +61,7 @@ export const deleteAccount = `mutation DeleteAccount($accountId: String!) {
name
type
entity
balance
createdAt
updatedAt
}
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/actions/api/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const getAccount = `query GetAccount($accountId: String!) {
name
category
type
balance
createdAt
updatedAt
}
Expand All @@ -36,6 +37,7 @@ export const getAccounts = `query GetAccounts($lastEvaluatedKey: String) {
name
category
type
balance
createdAt
updatedAt
}
Expand Down
Binary file modified references/Tables.xlsx
Binary file not shown.

0 comments on commit bdd701e

Please sign in to comment.