Skip to content

Commit

Permalink
feat: readded rwa document
Browse files Browse the repository at this point in the history
  • Loading branch information
froid1911 committed Mar 15, 2024
1 parent fda58cc commit 1295fb6
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 47 deletions.
77 changes: 54 additions & 23 deletions api/src/graphql/generated/drive/nexus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,18 +387,28 @@ export interface NexusGenObjects {
}
Query: {};
RealWorldAssets: { // root type
created: NexusGenScalars['Date']; // Date!
documentType: string; // String!
id: string; // String!
lastModified: NexusGenScalars['Date']; // Date!
name: string; // String!
operations: NexusGenRootTypes['Operation'][]; // [Operation!]!
revision: number; // Int!
state: NexusGenRootTypes['RealWorldAssetsState']; // RealWorldAssetsState!
}
RealWorldAssetsPortfolio: { // root type
accounts: NexusGenRootTypes['Account'][]; // [Account!]!
fixedIncomeTypes: NexusGenRootTypes['FixedIncomeType'][]; // [FixedIncomeType!]!
id: string; // ID!
portfolio: NexusGenRootTypes['Asset'][]; // [Asset!]!
principalLenderAccountId: string; // ID!
serviceProviderFeeTypes: NexusGenRootTypes['ServiceProviderFeeType'][]; // [ServiceProviderFeeType!]!
spvs: NexusGenRootTypes['Spv'][]; // [Spv!]!
transactions: NexusGenRootTypes['GroupTransaction'][]; // [GroupTransaction!]!
}
RealWorldAssetsPortfolio: { // root type
RealWorldAssetsState: { // root type
accounts: NexusGenRootTypes['Account'][]; // [Account!]!
fixedIncomeTypes: NexusGenRootTypes['FixedIncomeType'][]; // [FixedIncomeType!]!
id: string; // ID!
portfolio: NexusGenRootTypes['Asset'][]; // [Asset!]!
principalLenderAccountId: string; // ID!
serviceProviderFeeTypes: NexusGenRootTypes['ServiceProviderFeeType'][]; // [ServiceProviderFeeType!]!
Expand Down Expand Up @@ -550,8 +560,8 @@ export interface NexusGenObjects {
}

export interface NexusGenInterfaces {
Document: NexusGenRootTypes['AccountSnapshot'] | NexusGenRootTypes['BudgetStatement'] | NexusGenRootTypes['DefaultDocument'] | NexusGenRootTypes['ScopeFramework'];
IRealWorldAssets: NexusGenRootTypes['RealWorldAssets'] | NexusGenRootTypes['RealWorldAssetsPortfolio'];
IDocument: NexusGenRootTypes['AccountSnapshot'] | NexusGenRootTypes['BudgetStatement'] | NexusGenRootTypes['DefaultDocument'] | NexusGenRootTypes['RealWorldAssets'] | NexusGenRootTypes['ScopeFramework'];
IRealWorldAssetsState: NexusGenRootTypes['RealWorldAssetsPortfolio'] | NexusGenRootTypes['RealWorldAssetsState'];
Operation: any;
System: NexusGenRootTypes['SwitchboardDrive'] | NexusGenRootTypes['SwitchboardHost'];
}
Expand Down Expand Up @@ -843,24 +853,34 @@ export interface NexusGenFieldTypes {
Query: { // field return type
coreUnit: NexusGenRootTypes['CoreUnit'] | null; // CoreUnit
coreUnits: Array<NexusGenRootTypes['CoreUnit'] | null> | null; // [CoreUnit]
document: NexusGenRootTypes['Document'] | null; // Document
document: NexusGenRootTypes['IDocument'] | null; // IDocument
drive: NexusGenRootTypes['DocumentDriveState'] | null; // DocumentDriveState
rwaPortfolios: Array<NexusGenRootTypes['RealWorldAssetsPortfolio'] | null> | null; // [RealWorldAssetsPortfolio]
system: NexusGenRootTypes['SwitchboardDrive'] | null; // SwitchboardDrive
}
RealWorldAssets: { // field return type
created: NexusGenScalars['Date']; // Date!
documentType: string; // String!
id: string; // String!
lastModified: NexusGenScalars['Date']; // Date!
name: string; // String!
operations: NexusGenRootTypes['Operation'][]; // [Operation!]!
revision: number; // Int!
state: NexusGenRootTypes['RealWorldAssetsState']; // RealWorldAssetsState!
}
RealWorldAssetsPortfolio: { // field return type
accounts: NexusGenRootTypes['Account'][]; // [Account!]!
fixedIncomeTypes: NexusGenRootTypes['FixedIncomeType'][]; // [FixedIncomeType!]!
id: string; // ID!
portfolio: NexusGenRootTypes['Asset'][]; // [Asset!]!
principalLenderAccountId: string; // ID!
serviceProviderFeeTypes: NexusGenRootTypes['ServiceProviderFeeType'][]; // [ServiceProviderFeeType!]!
spvs: NexusGenRootTypes['Spv'][]; // [Spv!]!
transactions: NexusGenRootTypes['GroupTransaction'][]; // [GroupTransaction!]!
}
RealWorldAssetsPortfolio: { // field return type
RealWorldAssetsState: { // field return type
accounts: NexusGenRootTypes['Account'][]; // [Account!]!
fixedIncomeTypes: NexusGenRootTypes['FixedIncomeType'][]; // [FixedIncomeType!]!
id: string; // ID!
portfolio: NexusGenRootTypes['Asset'][]; // [Asset!]!
principalLenderAccountId: string; // ID!
serviceProviderFeeTypes: NexusGenRootTypes['ServiceProviderFeeType'][]; // [ServiceProviderFeeType!]!
Expand Down Expand Up @@ -1016,7 +1036,7 @@ export interface NexusGenFieldTypes {
key: string; // String!
vested: boolean; // Boolean!
}
Document: { // field return type
IDocument: { // field return type
created: NexusGenScalars['Date']; // Date!
documentType: string; // String!
id: string; // String!
Expand All @@ -1025,7 +1045,7 @@ export interface NexusGenFieldTypes {
operations: NexusGenRootTypes['Operation'][]; // [Operation!]!
revision: number; // Int!
}
IRealWorldAssets: { // field return type
IRealWorldAssetsState: { // field return type
accounts: NexusGenRootTypes['Account'][]; // [Account!]!
fixedIncomeTypes: NexusGenRootTypes['FixedIncomeType'][]; // [FixedIncomeType!]!
portfolio: NexusGenRootTypes['Asset'][]; // [Asset!]!
Expand Down Expand Up @@ -1323,24 +1343,34 @@ export interface NexusGenFieldTypeNames {
Query: { // field return type name
coreUnit: 'CoreUnit'
coreUnits: 'CoreUnit'
document: 'Document'
document: 'IDocument'
drive: 'DocumentDriveState'
rwaPortfolios: 'RealWorldAssetsPortfolio'
system: 'SwitchboardDrive'
}
RealWorldAssets: { // field return type name
created: 'Date'
documentType: 'String'
id: 'String'
lastModified: 'Date'
name: 'String'
operations: 'Operation'
revision: 'Int'
state: 'RealWorldAssetsState'
}
RealWorldAssetsPortfolio: { // field return type name
accounts: 'Account'
fixedIncomeTypes: 'FixedIncomeType'
id: 'ID'
portfolio: 'Asset'
principalLenderAccountId: 'ID'
serviceProviderFeeTypes: 'ServiceProviderFeeType'
spvs: 'Spv'
transactions: 'GroupTransaction'
}
RealWorldAssetsPortfolio: { // field return type name
RealWorldAssetsState: { // field return type name
accounts: 'Account'
fixedIncomeTypes: 'FixedIncomeType'
id: 'ID'
portfolio: 'Asset'
principalLenderAccountId: 'ID'
serviceProviderFeeTypes: 'ServiceProviderFeeType'
Expand Down Expand Up @@ -1496,7 +1526,7 @@ export interface NexusGenFieldTypeNames {
key: 'String'
vested: 'Boolean'
}
Document: { // field return type name
IDocument: { // field return type name
created: 'Date'
documentType: 'String'
id: 'String'
Expand All @@ -1505,7 +1535,7 @@ export interface NexusGenFieldTypeNames {
operations: 'Operation'
revision: 'Int'
}
IRealWorldAssets: { // field return type name
IRealWorldAssetsState: { // field return type name
accounts: 'Account'
fixedIncomeTypes: 'FixedIncomeType'
portfolio: 'Asset'
Expand Down Expand Up @@ -1573,18 +1603,19 @@ export interface NexusGenArgTypes {
export interface NexusGenAbstractTypeMembers {
Asset: "Cash" | "FixedIncome"
ElementComponents: "ArticleComponent" | "CoreComponent" | "ScopeComponent" | "SectionComponent" | "TypeSpecificationComponent"
Document: "AccountSnapshot" | "BudgetStatement" | "DefaultDocument" | "ScopeFramework"
IRealWorldAssets: "RealWorldAssets" | "RealWorldAssetsPortfolio"
IDocument: "AccountSnapshot" | "BudgetStatement" | "DefaultDocument" | "RealWorldAssets" | "ScopeFramework"
IRealWorldAssetsState: "RealWorldAssetsPortfolio" | "RealWorldAssetsState"
System: "SwitchboardDrive" | "SwitchboardHost"
}

export interface NexusGenTypeInterfaces {
AccountSnapshot: "Document"
BudgetStatement: "Document"
DefaultDocument: "Document"
RealWorldAssets: "IRealWorldAssets"
RealWorldAssetsPortfolio: "IRealWorldAssets"
ScopeFramework: "Document"
AccountSnapshot: "IDocument"
BudgetStatement: "IDocument"
DefaultDocument: "IDocument"
RealWorldAssets: "IDocument"
RealWorldAssetsPortfolio: "IRealWorldAssetsState"
RealWorldAssetsState: "IRealWorldAssetsState"
ScopeFramework: "IDocument"
SwitchboardDrive: "System"
SwitchboardHost: "System"
}
Expand All @@ -1603,7 +1634,7 @@ export type NexusGenUnionNames = keyof NexusGenUnions;

export type NexusGenObjectsUsingAbstractStrategyIsTypeOf = never;

export type NexusGenAbstractsUsingStrategyResolveType = "Asset" | "Document" | "ElementComponents" | "IRealWorldAssets" | "Operation" | "System";
export type NexusGenAbstractsUsingStrategyResolveType = "Asset" | "ElementComponents" | "IDocument" | "IRealWorldAssetsState" | "Operation" | "System";

export type NexusGenFeaturesConfig = {
abstractTypeStrategies: {
Expand Down
49 changes: 30 additions & 19 deletions api/src/graphql/generated/drive/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Account {
reference: String!
}

type AccountSnapshot implements Document {
type AccountSnapshot implements IDocument {
created: Date!
documentType: String!
id: String!
Expand Down Expand Up @@ -94,7 +94,7 @@ type BaseTransaction {
txRef: String
}

type BudgetStatement implements Document {
type BudgetStatement implements IDocument {
created: Date!
documentType: String!
id: String!
Expand Down Expand Up @@ -175,17 +175,7 @@ type CoreUnit {
"""Date custom scalar type"""
scalar Date

type DefaultDocument implements Document {
created: Date!
documentType: String!
id: String!
lastModified: Date!
name: String!
operations: [Operation!]!
revision: Int!
}

interface Document {
type DefaultDocument implements IDocument {
created: Date!
documentType: String!
id: String!
Expand Down Expand Up @@ -260,7 +250,17 @@ enum GroupTransactionType {
PrincipalReturn
}

interface IRealWorldAssets {
interface IDocument {
created: Date!
documentType: String!
id: String!
lastModified: Date!
name: String!
operations: [Operation!]!
revision: Int!
}

interface IRealWorldAssetsState {
accounts: [Account!]!
fixedIncomeTypes: [FixedIncomeType!]!
portfolio: [Asset!]!
Expand Down Expand Up @@ -413,26 +413,37 @@ type Owner {
type Query {
coreUnit(id: String): CoreUnit
coreUnits: [CoreUnit]
document(id: String!): Document
document(id: String!): IDocument
drive: DocumentDriveState
rwaPortfolios: [RealWorldAssetsPortfolio]
system: SwitchboardDrive
}

type RealWorldAssets implements IRealWorldAssets {
type RealWorldAssets implements IDocument {
created: Date!
documentType: String!
id: String!
lastModified: Date!
name: String!
operations: [Operation!]!
revision: Int!
state: RealWorldAssetsState!
}

type RealWorldAssetsPortfolio implements IRealWorldAssetsState {
accounts: [Account!]!
fixedIncomeTypes: [FixedIncomeType!]!
id: ID!
portfolio: [Asset!]!
principalLenderAccountId: ID!
serviceProviderFeeTypes: [ServiceProviderFeeType!]!
spvs: [Spv!]!
transactions: [GroupTransaction!]!
}

type RealWorldAssetsPortfolio implements IRealWorldAssets {
type RealWorldAssetsState implements IRealWorldAssetsState {
accounts: [Account!]!
fixedIncomeTypes: [FixedIncomeType!]!
id: ID!
portfolio: [Asset!]!
principalLenderAccountId: ID!
serviceProviderFeeTypes: [ServiceProviderFeeType!]!
Expand All @@ -453,7 +464,7 @@ type ScopeComponent {
content: String
}

type ScopeFramework implements Document {
type ScopeFramework implements IDocument {
created: Date!
documentType: String!
id: String!
Expand Down
2 changes: 0 additions & 2 deletions api/src/modules/document/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import {
} from 'document-model-libs/document-drive';


import { actions as rwaActions } from 'document-model-libs/dist/real-world-assets'

import { init } from './listenerManager';
import { getChildLogger } from '../../logger';

Expand Down
2 changes: 1 addition & 1 deletion api/src/modules/document/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const operationModelInterface = interfaceType({

// todo: resolveType should be moved to somewhere else
export const documentModelInterface = interfaceType({
name: 'Document',
name: 'IDocument',
definition(t) {
t.nonNull.string('id');
t.nonNull.string('name');
Expand Down
13 changes: 11 additions & 2 deletions api/src/modules/real-world-assets/resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { enumType, interfaceType, list, objectType, queryField, unionType } from 'nexus';
import { GQLDateBase } from '../system';
import { documentModelInterface } from '../document';

export const Account = objectType({
name: "Account",
Expand Down Expand Up @@ -74,7 +75,7 @@ export const GroupTransaction = objectType({
}
})
export const RealWorldAssetsStateInterface = interfaceType({
name: "IRealWorldAssets",
name: "IRealWorldAssetsState",
definition(t) {
t.nonNull.list.nonNull.field("accounts", { type: Account })
t.nonNull.id("principalLenderAccountId")
Expand All @@ -87,7 +88,7 @@ export const RealWorldAssetsStateInterface = interfaceType({
})

export const RealWorldAssetsState = objectType({
name: "RealWorldAssets",
name: "RealWorldAssetsState",
definition(t) {
t.implements(RealWorldAssetsStateInterface)
}
Expand Down Expand Up @@ -145,6 +146,14 @@ export const RealWorldAssetsPortfolio = objectType({
}
})

export const RealWorldAssetsDocument = objectType({
name: 'RealWorldAssets',
definition(t) {
t.implements(documentModelInterface);
t.nonNull.field('state', { type: RealWorldAssetsState });
},
});

export const rwaQuery = queryField('rwaPortfolios', {
type: list(RealWorldAssetsPortfolio),
// args: {
Expand Down

0 comments on commit 1295fb6

Please sign in to comment.