Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/739 - Account module migrated from identity to state #773

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/bri-3/src/bri/identity/identity.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Module } from '@nestjs/common';
import { AccountModule } from './bpiAccounts/accounts.module';
import { AccountModule } from '../state/bpiAccounts/accounts.module';
import { SubjectAccountModule } from './bpiSubjectAccounts/subjectAccounts.module';
import { SubjectModule } from './bpiSubjects/subjects.module';

Expand Down
6 changes: 3 additions & 3 deletions examples/bri-3/src/bri/state/agents/state.agent.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Injectable, NotFoundException } from '@nestjs/common';

import MerkleTree from 'merkletreejs';
import { BpiAccountStorageAgent } from '../../identity/bpiAccounts/agents/bpiAccountsStorage.agent';
import { BpiAccount } from '../../identity/bpiAccounts/models/bpiAccount';
import { BpiAccountStorageAgent } from '../bpiAccounts/agents/bpiAccountsStorage.agent';
import { BpiAccount } from '../bpiAccounts/models/bpiAccount';
import { MerkleTreeAgent } from '../../merkleTree/agents/merkleTree.agent';
import { MerkleTreeStorageAgent } from '../../merkleTree/agents/merkleTreeStorage.agent';
import { Witness } from '../../zeroKnowledgeProof/models/witness';
import { StateTreeLeafValueContent } from '../models/stateTreeLeafValueContent';
import { InjectMapper } from '@automapper/nestjs';
import { Mapper } from '@automapper/core';
import { LEAF_STATE_VALUE_NOT_FOUND_ERR_MESSAGE } from '../../identity/bpiAccounts/api/err.messages';
import { LEAF_STATE_VALUE_NOT_FOUND_ERR_MESSAGE } from '../bpiAccounts/api/err.messages';

// TODO: #741 We should follow this approach everywhere for storage
// https://www.prisma.io/docs/guides/performance-and-optimization/prisma-client-transactions-guide#scenario-pre-computed-ids-and-the-transaction-api
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Module } from '@nestjs/common';
import { CqrsModule } from '@nestjs/cqrs';
import { MerkleModule } from '../../merkleTree/merkle.module';
import { SubjectAccountModule } from '../bpiSubjectAccounts/subjectAccounts.module';
import { SubjectAccountModule } from '../../identity/bpiSubjectAccounts/subjectAccounts.module';
import { AccountsProfile } from './accounts.profile';
import { BpiAccountAgent } from './agents/bpiAccounts.agent';
import { BpiAccountStorageAgent } from './agents/bpiAccountsStorage.agent';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { v4 } from 'uuid';
import { BpiSubjectAccount } from '../../bpiSubjectAccounts/models/bpiSubjectAccount';
import { BpiSubjectAccount } from '../../../identity/bpiSubjectAccounts/models/bpiSubjectAccount';

import { NOT_FOUND_ERR_MESSAGE } from '../api/err.messages';
import { BpiAccount } from '../models/bpiAccount';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { PrismaService } from '../../../../../prisma/prisma.service';
import { Witness } from '../../../zeroKnowledgeProof/models/witness';
import { NOT_FOUND_ERR_MESSAGE } from '../api/err.messages';
import { BpiAccount } from '../models/bpiAccount';
import { StateTreeLeafValueContent } from '../../../state/models/stateTreeLeafValueContent';
import { StateTreeLeafValueContent } from '../../models/stateTreeLeafValueContent';

// Repositories are the only places that talk the Prisma language of models.
// They are always mapped to and from domain objects so that the business layer of the application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
import { MerkleTreeStorageAgent } from '../../../merkleTree/agents/merkleTreeStorage.agent';
import { MerkleModule } from '../../../merkleTree/merkle.module';
import { BpiMerkleTree } from '../../../merkleTree/models/bpiMerkleTree';
import { BpiSubjectAccountAgent } from '../../bpiSubjectAccounts/agents/bpiSubjectAccounts.agent';
import { BpiSubjectAccountStorageAgent } from '../../bpiSubjectAccounts/agents/bpiSubjectAccountsStorage.agent';
import { NOT_FOUND_ERR_MESSAGE as SUBJECT_ACCOUNT_NOT_FOUND_ERR_MESSAGE } from '../../bpiSubjectAccounts/api/err.messages';
import { BpiSubjectAccount } from '../../bpiSubjectAccounts/models/bpiSubjectAccount';
import { SubjectAccountsProfile } from '../../bpiSubjectAccounts/subjectAccounts.profile';
import { BpiSubjectStorageAgent } from '../../bpiSubjects/agents/bpiSubjectsStorage.agent';
import { BpiSubject } from '../../bpiSubjects/models/bpiSubject';
import { SubjectsProfile } from '../../bpiSubjects/subjects.profile';
import { BpiSubjectAccountAgent } from '../../../identity/bpiSubjectAccounts/agents/bpiSubjectAccounts.agent';
import { BpiSubjectAccountStorageAgent } from '../../../identity/bpiSubjectAccounts/agents/bpiSubjectAccountsStorage.agent';
import { NOT_FOUND_ERR_MESSAGE as SUBJECT_ACCOUNT_NOT_FOUND_ERR_MESSAGE } from '../../../identity/bpiSubjectAccounts/api/err.messages';
import { BpiSubjectAccount } from '../../../identity/bpiSubjectAccounts/models/bpiSubjectAccount';
import { SubjectAccountsProfile } from '../../../identity/bpiSubjectAccounts/subjectAccounts.profile';
import { BpiSubjectStorageAgent } from '../../../identity/bpiSubjects/agents/bpiSubjectsStorage.agent';
import { BpiSubject } from '../../../identity/bpiSubjects/models/bpiSubject';
import { SubjectsProfile } from '../../../identity/bpiSubjects/subjects.profile';
import { AccountsProfile } from '../accounts.profile';
import { BpiAccountAgent } from '../agents/bpiAccounts.agent';
import { BpiAccountStorageAgent } from '../agents/bpiAccountsStorage.agent';
Expand All @@ -36,7 +36,7 @@
let accountController: AccountController;
let accountStorageAgentMock: DeepMockProxy<BpiAccountStorageAgent>;
let subjectAccountStorageAgentMock: DeepMockProxy<BpiSubjectAccountStorageAgent>;
let merkleTreeStorageAgentMock: DeepMockProxy<MerkleTreeStorageAgent>;

Check warning on line 39 in examples/bri-3/src/bri/state/bpiAccounts/api/accounts.controller.spec.ts

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 16.17.0)

'merkleTreeStorageAgentMock' is assigned a value but never used

beforeAll(async () => {
process.env.MERKLE_TREE_HASH_ALGH = 'sha256';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AutoMap } from '@automapper/classes';
import { MerkleTreeDto } from '../../../../..//merkleTree/api/dtos/response/merkleTree.dto';
import { BpiSubjectAccountDto } from '../../../../bpiSubjectAccounts/api/dtos/response/bpiSubjectAccount.dto';
import { MerkleTreeDto } from '../../../../../merkleTree/api/dtos/response/merkleTree.dto';
import { BpiSubjectAccountDto } from '../../../../../identity/bpiSubjectAccounts/api/dtos/response/bpiSubjectAccount.dto';

export class BpiAccountDto {
@AutoMap()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { BpiSubjectAccountAgent } from '../../../bpiSubjectAccounts/agents/bpiSubjectAccounts.agent';
import { BpiSubjectAccountAgent } from '../../../../identity/bpiSubjectAccounts/agents/bpiSubjectAccounts.agent';
import { BpiAccountAgent } from '../../agents/bpiAccounts.agent';
import { BpiAccountStorageAgent } from '../../agents/bpiAccountsStorage.agent';
import { CreateBpiAccountCommand } from './createBpiAccount.command';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AutoMap } from '@automapper/classes';
import { BpiMerkleTree } from '../../../merkleTree/models/bpiMerkleTree';
import { BpiSubjectAccount } from '../../bpiSubjectAccounts/models/bpiSubjectAccount';
import { BpiSubjectAccount } from '../../../identity/bpiSubjectAccounts/models/bpiSubjectAccount';

export class BpiAccount {
@AutoMap()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Mapper } from '@automapper/core';
import { InjectMapper } from '@automapper/nestjs';
import { IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { BpiAccountAgent } from '../../../identity/bpiAccounts/agents/bpiAccounts.agent';
import { BpiAccountAgent } from '../../bpiAccounts/agents/bpiAccounts.agent';
import { MerkleTreeAgent } from '../../../merkleTree/agents/merkleTree.agent';
import { StateAgent } from '../../agents/state.agent';
import { StateTreeLeafValueContentDto } from '../../api/dtos/response/stateTreeLeafValueContent.dto';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AutoMap } from '@automapper/classes';
import { BpiAccount } from '../../identity/bpiAccounts/models/bpiAccount';
import { BpiAccount } from '../bpiAccounts/models/bpiAccount';
import MerkleTree from 'merkletreejs';

export class StateTreeLeafValueContent {
Expand Down
2 changes: 1 addition & 1 deletion examples/bri-3/src/bri/state/state.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Module } from '@nestjs/common';
import { CqrsModule } from '@nestjs/cqrs';
import { AccountModule } from '../identity/bpiAccounts/accounts.module';
import { AccountModule } from './bpiAccounts/accounts.module';
import { MerkleModule } from '../merkleTree/merkle.module';
import { StateAgent } from './agents/state.agent';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '../api/err.messages';
import { Workflow } from '../models/workflow';
import { WorkflowStorageAgent } from './workflowsStorage.agent';
import { BpiAccount } from 'src/bri/identity/bpiAccounts/models/bpiAccount';
import { BpiAccount } from 'src/bri/state/bpiAccounts/models/bpiAccount';

@Injectable()
export class WorkflowAgent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { DeepMockProxy, mockDeep } from 'jest-mock-extended';
import { validate as uuidValidate, version as uuidVersion } from 'uuid';
import { uuid } from 'uuidv4';
import { TestDataHelper } from '../../../../shared/testing/testData.helper';
import { BpiAccountAgent } from '../../../identity/bpiAccounts/agents/bpiAccounts.agent';
import { BpiAccountStorageAgent } from '../../../identity/bpiAccounts/agents/bpiAccountsStorage.agent';
import { BpiAccountAgent } from '../../../state/bpiAccounts/agents/bpiAccounts.agent';
import { BpiAccountStorageAgent } from '../../../state/bpiAccounts/agents/bpiAccountsStorage.agent';
import { BpiSubjectAccountAgent } from '../../../identity/bpiSubjectAccounts/agents/bpiSubjectAccounts.agent';
import { WORKFLOW_NOT_FOUND_ERR_MESSAGE } from '../../workflows/api/err.messages';
import { WorkgroupAgent } from '../../workgroups/agents/workgroups.agent';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { BpiAccountAgent } from '../../../../identity/bpiAccounts/agents/bpiAccounts.agent';
import { BpiAccountStorageAgent } from '../../../../identity/bpiAccounts/agents/bpiAccountsStorage.agent';
import { BpiAccountAgent } from '../../../../state/bpiAccounts/agents/bpiAccounts.agent';
import { BpiAccountStorageAgent } from '../../../../state/bpiAccounts/agents/bpiAccountsStorage.agent';
import { BpiSubjectAccountAgent } from '../../../../identity/bpiSubjectAccounts/agents/bpiSubjectAccounts.agent';
import { WorkgroupAgent } from '../../../../workgroup/workgroups/agents/workgroups.agent';
import { WorkflowAgent } from '../../agents/workflows.agent';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AutoMap } from '@automapper/classes';
import { BpiAccount } from '../../../identity/bpiAccounts/models/bpiAccount';
import { BpiAccount } from '../../../state/bpiAccounts/models/bpiAccount';
import { Workgroup } from '../../workgroups/models/workgroup';
import { Workstep } from '../../worksteps/models/workstep';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Module } from '@nestjs/common';
import { CqrsModule } from '@nestjs/cqrs';
import { AccountModule } from '../../identity/bpiAccounts/accounts.module';
import { AccountModule } from '../../state/bpiAccounts/accounts.module';
import { SubjectAccountModule } from '../../identity/bpiSubjectAccounts/subjectAccounts.module';
import { SubjectModule } from '../../identity/bpiSubjects/subjects.module';
import { WorkgroupStorageAgent } from '../workgroups/agents/workgroupStorage.agent';
Expand Down
2 changes: 1 addition & 1 deletion examples/bri-3/src/shared/testing/builders.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-empty-function */

import { BpiAccount } from '../../bri/identity/bpiAccounts/models/bpiAccount';
import { BpiAccount } from '../../bri/state/bpiAccounts/models/bpiAccount';
import { BpiSubjectAccount } from '../../bri/identity/bpiSubjectAccounts/models/bpiSubjectAccount';
import { BpiSubject } from '../../bri/identity/bpiSubjects/models/bpiSubject';
import { BpiSubjectRole } from '../../bri/identity/bpiSubjects/models/bpiSubjectRole';
Expand Down
2 changes: 1 addition & 1 deletion examples/bri-3/src/shared/testing/testData.helper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { uuid } from 'uuidv4';
import { BpiAccount } from '../../bri/identity/bpiAccounts/models/bpiAccount';
import { BpiAccount } from '../../bri/state/bpiAccounts/models/bpiAccount';
import { BpiSubjectAccount } from '../../bri/identity/bpiSubjectAccounts/models/bpiSubjectAccount';
import { BpiSubject } from '../../bri/identity/bpiSubjects/models/bpiSubject';
import {
Expand Down
Loading