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

more accurate name for user wallet relation + pluralize many relations #386

Merged
merged 7 commits into from
Dec 5, 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@charmverse/core",
"version": "0.98.1",
"version": "0.98.2-rc-scout-wallets.0",
"description": "Core API for Charmverse",
"type": "commonjs",
"types": "./dist/cjs/index.d.ts",
Expand Down
36 changes: 18 additions & 18 deletions src/lib/permissions/getSpaceInfoViaResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,24 +246,24 @@ export async function getSpaceInfoViaResource({
!resourceIdType || resourceIdType === 'space'
? isSpaceOptedIn
: resourceIdType === 'postCategory'
? isPostCategorySpaceOptedIn
: resourceIdType === 'postCategoryPermission'
? isPostCategoryPermissionSpaceOptedIn
: resourceIdType === 'post'
? isPostSpaceOptedIn
: resourceIdType === 'proposal'
? isProposalSpaceOptedIn
: resourceIdType === 'page'
? isPageSpaceOptedIn
: resourceIdType === 'pagePermission'
? isPagePermissionSpaceOptedIn
: resourceIdType === 'bounty'
? isBountySpaceOptedIn
: resourceIdType === 'vote'
? isVoteSpaceOptedIn
: resourceIdType === 'role'
? isRoleSpaceOptedIn
: null;
? isPostCategorySpaceOptedIn
: resourceIdType === 'postCategoryPermission'
? isPostCategoryPermissionSpaceOptedIn
: resourceIdType === 'post'
? isPostSpaceOptedIn
: resourceIdType === 'proposal'
? isProposalSpaceOptedIn
: resourceIdType === 'page'
? isPageSpaceOptedIn
: resourceIdType === 'pagePermission'
? isPagePermissionSpaceOptedIn
: resourceIdType === 'bounty'
? isBountySpaceOptedIn
: resourceIdType === 'vote'
? isVoteSpaceOptedIn
: resourceIdType === 'role'
? isRoleSpaceOptedIn
: null;

if (!engineResolver) {
throw new InvalidInputError(`Invalid resolver provided`);
Expand Down
23 changes: 11 additions & 12 deletions src/lib/testing/proposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,17 @@ export async function generateProposal({
);

const evaluationReviewersToCreate: Prisma.ProposalReviewerCreateManyInput[] =
evaluationInputsWithIdAndIndex.flatMap(
(input) =>
input.reviewers?.map(
(reviewer) =>
({
proposalId,
evaluationId: input.id,
roleId: reviewer.group === 'role' ? reviewer.id : undefined,
userId: reviewer.group === 'user' ? reviewer.id : undefined,
systemRole: ProposalSystemRole[reviewer.group as ProposalSystemRole] ? reviewer.group : undefined
}) as Prisma.ProposalReviewerCreateManyInput
)
evaluationInputsWithIdAndIndex.flatMap((input) =>
input.reviewers?.map(
(reviewer) =>
({
proposalId,
evaluationId: input.id,
roleId: reviewer.group === 'role' ? reviewer.id : undefined,
userId: reviewer.group === 'user' ? reviewer.id : undefined,
systemRole: ProposalSystemRole[reviewer.group as ProposalSystemRole] ? reviewer.group : undefined
}) as Prisma.ProposalReviewerCreateManyInput
)
);

const evaluationAppealReviewersToCreate: Prisma.ProposalAppealReviewerCreateManyInput[] =
Expand Down
22 changes: 11 additions & 11 deletions src/lib/testing/spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,18 @@ export async function addSpaceOperations({
}
}
: group === 'role'
? {
roleId_forSpaceId: {
roleId: id,
forSpaceId
}
}
: {
spaceId_forSpaceId: {
spaceId: id,
forSpaceId
? {
roleId_forSpaceId: {
roleId: id,
forSpaceId
}
}
};
: {
spaceId_forSpaceId: {
spaceId: id,
forSpaceId
}
};

await prisma.spacePermission.upsert({
where: query,
Expand Down
12 changes: 6 additions & 6 deletions src/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -2811,10 +2811,10 @@ model Scout {
onboardedAt DateTime?
currentBalance Int @default(0)
hasMoxieProfile Boolean @default(false)
scoutWallet ScoutWallet[]
wallets ScoutWallet[]
strikes BuilderStrike[]
events BuilderEvent[]
githubUser GithubUser[]
githubUsers GithubUser[]
gemsPayoutEvents GemsPayoutEvent[]
pointsReceived PointsReceipt[] @relation("pointsReceiptRecipient")
pointsSent PointsReceipt[] @relation("pointsReceiptSender")
Expand All @@ -2824,17 +2824,17 @@ model Scout {
nftPurchaseEvents NFTPurchaseEvent[] @relation("nftPurchaseEventScout")
builderNfts BuilderNft[]
activities ScoutGameActivity[]
PendingNftTransaction PendingNftTransaction[]
pendingNftTransactions PendingNftTransaction[]
builderCardActivities BuilderCardActivity[]
tokensReceived TokensReceipt[] @relation("tokenReceiptRecipient")
tokensSent TokensReceipt[] @relation("tokenReceiptSender")
onchainProfileAttestationUid String?
onchainProfileAttestationChainId Int?
scoutSocialQuests ScoutSocialQuest[]
socialQuests ScoutSocialQuest[]
dailyClaimEvents ScoutDailyClaimEvent[]
dailyClaimStreakEvents ScoutDailyClaimStreakEvent[]
referralCode String @unique
referralCodeEvent ReferralCodeEvent[]
referralCodeEvents ReferralCodeEvent[]
talentProfile TalentProfile?
mergedFromEvents ScoutMergeEvent[] @relation("mergedFromScout")
mergedToEvents ScoutMergeEvent[] @relation("mergedToScout")
Expand Down Expand Up @@ -2998,7 +2998,7 @@ model NFTPurchaseEvent {
tokensPurchased Int
pointsValue Int
builderNftId String @db.Uuid
builderNFT BuilderNft @relation(fields: [builderNftId], references: [id], onDelete: Cascade)
builderNft BuilderNft @relation(fields: [builderNftId], references: [id], onDelete: Cascade)
txHash String
builderEvent BuilderEvent?
activities ScoutGameActivity[]
Expand Down