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

refactor: add unclaimed project owner field #37

Merged
merged 1 commit into from
Oct 30, 2024
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
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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the typecast needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, no need, leftover from copy paste. Noted to remove it to the next PR.

},
} as ResolverUnClaimedProjectData;
}

Expand Down
Loading