7.28 Migrate GraphQL Type Definitions to TypeScript#337
Open
shubham-01-star wants to merge 8 commits intoQuoteVote:mainfrom
Open
7.28 Migrate GraphQL Type Definitions to TypeScript#337shubham-01-star wants to merge 8 commits intoQuoteVote:mainfrom
shubham-01-star wants to merge 8 commits intoQuoteVote:mainfrom
Conversation
Port Activity, Activities, Pagination, Comment, Group, Post, Posts, Quote, User, UserInvite, UserReputation, Vote SDL typedefs from the legacy JS package to TypeScript under app/data/types/. Each export is annotated `: string` and uses the `#graphql` tag for IDE syntax highlighting (matches the convention in solidTypeDefs.ts). Legacy SDL field names (_id, admin, _followingId, enable_voting, etc.) are preserved verbatim so existing frontend queries remain compatible; Prisma's @Map() directives bridge these to the renamed storage fields. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…peScript Port ChatRoom, Message, MessageRoom, Notification, Reaction, Presence, Roster, TypingIndicator SDL typedefs from JS to TypeScript under app/data/types/. Preserves all enum definitions (PresenceStatus, RosterStatus) and response types (HeartbeatResponse, TypingResponse, BuddyWithPresence, DeletedRoster, PostDetails) verbatim. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Port DeletedPost, DeletedQuote, DeletedComment, DeletedVote, DeletedMessage soft-delete response typedefs to TypeScript and add an index.ts barrel that re-exports all 25 typedef modules in the same order as the legacy JS package. This completes the GraphQL typedef migration — app/data/types/ now contains the full set of 25 TypeScript SDL modules backing the Apollo Server schema. Ready to be composed into the server's schema pipeline once resolver migration lands. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Introduce JSONScalar and DateScalar via GraphQLScalarType so Date and arbitrary JSON (avatar, readBy, users map) are first-class in the schema instead of leaking as plain String. Introduce PresenceStatusEnum and RosterStatusEnum via GraphQLEnumType, mirroring the Common.PresenceStatus / Common.RosterStatus string unions. Consumed by the per-type GraphQLObjectType modules in the follow-up commits. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Rewrite the self-contained typedef modules using new GraphQLObjectType
bound to their shared Common.* interface via GraphQLFieldConfigMap<TSource,
GraphQLContext>. Covered here:
- Pagination -> Common.Pagination
- DeletedPost/Quote/Comment/Vote/Message response payloads
- Reaction -> Common.Reaction
- UserInvite -> Common.UserInvite
- UserReputation -> Common.Reputation (plus ReputationMetrics /
ReputationHistory / UserReport sub-types)
Field types now carry compile-time checks against the shared domain/Prisma
type system (e.g. reputation metrics use GraphQLInt aligned with the
numeric fields on Common.ReputationMetrics).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ic form
Rewrite every cross-referenced typedef as a strongly-typed
GraphQLObjectType<TSource, GraphQLContext>. Circular references across
files (User<->Post, Post<->Comment/Vote/Quote/MessageRoom,
Activity<->Post/Vote/Quote/Comment/User, etc.) are handled via the
fields: () => ({...}) thunk so ES-module load order is irrelevant.
Covered:
- User, Vote, Quote, Comment, Message, Group, ChatRoom
- MessageRoom (+ PostDetails sub-type)
- Post, Posts
- Notification, Activity, Activities
- Presence (+ PresenceUpdate, HeartbeatResponse)
- Roster (+ BuddyWithPresence, DeletedRoster)
- TypingIndicator (+ TypingResponse)
All types are bound to Common.* source interfaces from ~/types/common,
so adding a field that diverges from the Prisma-backed domain shape is
a TypeScript error — not a runtime surprise.
Legacy SDL field names (_id, admin, _followingId, _wallet, enable_voting,
etc.) are preserved for frontend compatibility; Prisma @Map() continues
to bridge to the renamed storage fields.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Introduce app/data/types/index.ts as the barrel exporting every programmatic
GraphQL type plus aggregated helpers:
- domainTypes: readonly array of all 25 legacy types + sub-types, scalars, enums
- domainTypeDefs: printed SDL aggregating every domain type via printType()
Wire domainTypeDefs into app/server.ts so the running Apollo Server's
typeDefs now contain the full domain schema alongside the existing
Query/Mutation/Solid SDL. Removes the now-duplicate inline 'scalar JSON'
since JSONScalar from the new types module provides it.
Add __tests__/unit/graphql-types.test.ts — a 28-test smoke suite that:
1. Asserts every one of the 25 legacy typedef names is a programmatic
GraphQLObjectType with resolvable fields (no circular-import errors)
2. Composes a GraphQLSchema from domainTypes and asserts every expected
type name (plus 13 sub-types, scalars, enums) appears in schema.getTypeMap()
3. Round-trips domainTypeDefs through buildSchema + printSchema to verify
the printed SDL parses back to a valid schema
Satisfies ticket 7.28 acceptance criteria: 'GraphQL schema construction works
with the new TypeScript modules' + 'introspect the schema to confirm type
structure'.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@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. |
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.
This PR migrates all GraphQL type definition modules from JavaScript to TypeScript under app/data/types/. The goal is to align GraphQL schema types with Prisma-backed domain models and the shared TypeScript type system for better type safety and maintainability.
Changes Made
Converted all .js type definition files to .ts, including:
Activities, Activity, ChatRooms, Comment, Deleted*, Group, Message*, Notification, Pagination, Post(s), Presence, Quote, Reaction, Roster, TypingIndicator, User*, Vote
Updated exports to use TypeScript with proper typings:
GraphQLObjectType
GraphQLFieldConfigMap
GraphQLList, GraphQLNonNull, etc.
Aligned GraphQL field types with:
Prisma model structures
Shared domain types
Ensured compatibility with:
app/types/graphql.ts (context + resolver typings)
Updated resolver imports to use TypeScript modules (extension-less or .ts)
Why This Change
Improves type safety across schema and resolvers
Ensures consistency between GraphQL, Prisma, and domain models
Makes future development and refactoring safer and easier
Validation
✅ npx tsc --noEmit passes without errors
✅ GraphQL schema builds successfully
✅ Schema introspection (GraphiQL / tooling) works as expected
✅ Existing resolvers continue to function correctly
✅ GraphQL tests pass