Feature/7.25 prisma schema simple models#321
Open
shubham-01-star wants to merge 33 commits intoQuoteVote:mainfrom
Open
Feature/7.25 prisma schema simple models#321shubham-01-star wants to merge 33 commits intoQuoteVote:mainfrom
shubham-01-star wants to merge 33 commits intoQuoteVote:mainfrom
Conversation
Add 7 simple Mongoose models with no static methods:
- BotReport.ts: userId/reporterId refs, compound unique index
- VoteLog.ts: userId/postId refs, type enum (up|down)
- UserReport.ts: reportedUserId/reporterId refs, reason, status
- Domain.ts: key (unique, required), name
- Creator.ts: name (required), avatar, bio
- Content.ts: creatorId (ref Creator), domainId (ref Domain), title, url
- Collection.ts: userId, name (required), description (String, bug fix), postIds[]
All schemas use Mongoose 9.x conventions with { timestamps: true }.
No deprecated options (useNewUrlParser etc.) anywhere.
Types imported from ~/types/mongoose.
Add 3 Mongoose models with Mongoose statics and indexes:
- Group.ts: creatorId/adminIds/allowedUserIds, privacy enum,
static findByCreatorId()
- UserInvite.ts: email (lowercase/trim), code, status, expiresAt,
indexes on {email}, {code}, {status},
static findByEmail()
- UserReputation.ts: userId (unique), 4 score fields, 10 nested
metrics fields, indexes on {overallScore:-1}/{lastCalculated},
statics findByUserId() + calculateScore() with dynamic import()
to break circular dependency with reputation.ts
All schemas use { timestamps: true } + Mongoose 9.x conventions.
Re-exports BotReport, Collection, Content, Creator, Domain, Group, UserInvite, UserReport, UserReputation, VoteLog from index.ts
79 tests across 12 model test files covering: - Create / Read / Update / Delete for each model - Static method tests (findByEmail, findByCreatorId, findByUserId, calculateScore) All tests pass: 362/362 suite-wide
- Add 16 missing fields to User interface (common.ts) matching Prisma schema:
bio, location, website, companyName, plan, stripeCustomerId, tokens,
_wallet, status, _votesId, favorited, emailVerified, isModerator,
blockedUserIds, settings, lastLogin
- Add ObjectId overrides in UserDocument (mongoose.ts)
- Expand User.ts Mongoose schema with all new fields and indexes
- Add User barrel export in models/index.ts
- Install stripe@20.4.1 as dependency
- Replace require('stripe') with proper ES import in getStripeAuth.ts
- Use Stripe SDK types (Stripe.Customer, Stripe.PaymentMethod,
Stripe.PaymentMethodCreateParams.Card) across all Stripe utilities
- Remove all Record<string, unknown> workarounds and inline type casts
- Update stripe.test.ts to use ES module mock format (remove virtual: true)
- Add comprehensive User.test.ts with 24 unit tests
All 386 tests pass, tsc --noEmit clean.
… and corresponding unit tests.
Add shared test helpers (_helpers.ts) for Mongoose schema validation testing and update jest.config.ts modulePathIgnorePatterns for proper test isolation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add comprehensive schema tests covering required fields, default values, enum validation, and field types for the core domain models. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cover vote type enum validation, soft-delete defaults, required fields, and VoteLog token/description constraints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cover message text requirement, soft-delete defaults, readBy/deliveredTo subdocs, room messageType enum, and isDirect defaults. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nce, Typing Cover emoji requirement, roster status enum (pending/accepted/declined/blocked), presence status enum, and typing TTL expiry behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ontent, Creator, Domain Cover activity event type enum, collection name requirement, content title requirement, creator fields, and domain key requirement. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…, UserInvite, UserReport, UserReputation, Group Cover notification type enum, report reason/status/severity enums, invite expiry, reputation score defaults, and group privacy enum. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cover SolidConnection CRUD operations and schema validation including webId/issuer requirements, tokens object, and connection status. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove unnecessary mock function declarations to align with the standardized Mongoose mock pattern used across all model tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d relations in social
|
@shubham-01-star is attempting to deploy a commit to the Louis Girifalco's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR aligns Prisma models for all simple, low-dependency entities to perfectly mirror their existing Mongoose schemas, preparing for local integration without breaking legacy mappings.
Changes Included
Activity,BotReport,Collection,Content,Creator,Domain,Group,Notification,UserInvite,UserReputation,VoteLog) to match Mongoose document shapes.createdAtandupdatedAttracking fields for models utilizing Mongoose{ timestamps: true }.GroupPrivacy,VoteType, andRosterStatusenums and updated mapped schema indexes to support Mongoose querying behaviors safely.__tests__/unit/prisma/*.prisma.test.ts) to verify basic operations and mapping validity.Testing
prisma validatehandles successfully.prisma generatehandles successfully.npx jest __tests__/unit/prisma/to see that CRUD mock validations pass cleanly.