Skip to content

Commit

Permalink
refactor: add unclaimed project owner field
Browse files Browse the repository at this point in the history
resolves: #35
  • Loading branch information
jtourkos committed Oct 30, 2024
1 parent 4ccd2a5 commit e9cdd37
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/project/projectResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,9 @@ const projectResolvers = {
parentProjectInfo: { projectId, projectChain },
}: ResolverUnClaimedProjectData) =>
getWithdrawableBalancesOnChain(projectId, projectChain),
owner: (
projectData: ResolverClaimedProjectData,
): AddressDriverAccount | null => projectData.owner,
},
Avatar: {
__resolveType(parent: { cid: string } | { emoji: string }) {
Expand Down
1 change: 1 addition & 0 deletions src/project/projectTypeDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const projectTypeDef = gql`
verificationStatus: ProjectVerificationStatus!
support: [SupportItem!]!
withdrawableBalances: [WithdrawableBalance!]!
owner: AddressDriverAccount!
}
input ProjectWhereInput {
Expand Down
8 changes: 8 additions & 0 deletions src/project/projectUtils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ZeroAddress } from 'ethers';
import type {
DbSchema,
Forge,
Expand Down Expand Up @@ -125,6 +126,8 @@ export async function toProjectRepresentation(
project.verificationStatus ?? ProjectVerificationStatus.Unclaimed,
isValid: true,
chain: project.chain,
ownerAddress: project.ownerAddress || ZeroAddress,
ownerAccountId: project.ownerAccountId || '0',
} as ProjectDataValues;
}

Expand Down Expand Up @@ -190,6 +193,11 @@ function mapUnClaimedProjectChainData(
support: [], // Will be populated by the resolver.
totalEarned: [], // Will be populated by the resolver.
withdrawableBalances: [], // Will be populated by the resolver.
owner: {
driver: Driver.ADDRESS,
accountId: fakeUnclaimedProject.ownerAccountId || '0',
address: (fakeUnclaimedProject.ownerAddress as string) || ZeroAddress,
},
} as ResolverUnClaimedProjectData;
}

Expand Down

0 comments on commit e9cdd37

Please sign in to comment.