Skip to content

Commit

Permalink
Merge branch 'develop-postgres' of https://github.com/MohitMaulekhi/t…
Browse files Browse the repository at this point in the history
…alawa-api into develop-postgres

for remote access
  • Loading branch information
MohitMaulekhi committed Feb 5, 2025
2 parents 7ef07ff + 1ac69dd commit 9c9dff1
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/push-deploy-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ on:
push:
branches:
- "develop-postgres"
paths:
- docs/**

env:
CODECOV_UNIQUE_NAME: CODECOV_UNIQUE_NAME-${{ github.run_id }}-${{ github.run_number }}
Expand Down
12 changes: 2 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
.docusaurus

# Don't upload configuration files
.env
.env_test
/.env*

# Ignore upload directories
cert/**
Expand Down Expand Up @@ -287,13 +286,6 @@ web_modules/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
Expand Down Expand Up @@ -839,7 +831,7 @@ FodyWeavers.xsd
.pnpm-store
package-lock.json
yarn.lock
./test/routes/graphql/gql.tada.d.ts
/test/routes/graphql/gql.tada.d.ts

# FNM
.node-version
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"generate_drizzle_migrations": "drizzle-kit generate",
"generate_graphql_sdl_file": "tsx ./scripts/generateGraphQLSDLFile.ts",
"generate_gql_tada": "gql.tada generate-output && gql.tada turbo --fail-on-warn",
"import:sample-data": "tsx ./src/utilities/loadSampleData.ts",
"push_drizzle_schema": "drizzle-kit push",
"push_drizzle_test_schema": "drizzle-kit push --config=./test/drizzle.config.ts",
"run_tests": "vitest --coverage",
Expand All @@ -96,4 +97,4 @@
},
"type": "module",
"version": "1.0.0"
}
}
17 changes: 11 additions & 6 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,11 @@ A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `dat
"""
scalar DateTime

"""
A field whose value conforms to the standard internet email address format as specified in HTML Spec: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address.
"""
scalar EmailAddress

type Event {
"""
GraphQL connection to traverse through the agenda folders that contain agenda items constituting a part of the agenda for the event.
Expand Down Expand Up @@ -1747,7 +1752,7 @@ input MutationCreateUserInput {
educationGrade: UserEducationGrade

"""Email address of the user."""
emailAddress: String!
emailAddress: EmailAddress!

"""Employment status of the user."""
employmentStatus: UserEmploymentStatus
Expand Down Expand Up @@ -1982,7 +1987,7 @@ input MutationSignUpInput {
educationGrade: UserEducationGrade

"""Email address of the user."""
emailAddress: String!
emailAddress: EmailAddress!

"""Employment status of the user."""
employmentStatus: UserEmploymentStatus
Expand Down Expand Up @@ -2202,7 +2207,7 @@ input MutationUpdateCurrentUserInput {
educationGrade: UserEducationGrade

"""Email address of the user."""
emailAddress: String
emailAddress: EmailAddress

"""Employment status of the user."""
employmentStatus: UserEmploymentStatus
Expand Down Expand Up @@ -2419,7 +2424,7 @@ input MutationUpdateUserInput {
educationGrade: UserEducationGrade

"""Email address of the user."""
emailAddress: String
emailAddress: EmailAddress

"""Employment status of the user."""
employmentStatus: UserEmploymentStatus
Expand Down Expand Up @@ -2965,7 +2970,7 @@ input QueryPostInput {
""""""
input QuerySignInInput {
"""Email address of the user."""
emailAddress: String!
emailAddress: EmailAddress!

"""Password of the user to sign in to talawa."""
password: String!
Expand Down Expand Up @@ -3149,7 +3154,7 @@ type User {
educationGrade: UserEducationGrade

"""Email address of the user."""
emailAddress: String
emailAddress: EmailAddress

"""Employment status of the user."""
employmentStatus: UserEmploymentStatus
Expand Down
3 changes: 2 additions & 1 deletion src/graphql/inputs/MutationCreateUserInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ export const MutationCreateUserInput = builder
description: "Primary education grade of the user.",
type: UserEducationGrade,
}),
emailAddress: t.string({
emailAddress: t.field({
description: "Email address of the user.",
required: true,
type: "EmailAddress",
}),
employmentStatus: t.field({
description: "Employment status of the user.",
Expand Down
3 changes: 2 additions & 1 deletion src/graphql/inputs/MutationSignUpInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ export const MutationSignUpInput = builder
description: "Primary education grade of the user.",
type: UserEducationGrade,
}),
emailAddress: t.string({
emailAddress: t.field({
description: "Email address of the user.",
required: true,
type: "EmailAddress",
}),
employmentStatus: t.field({
description: "Employment status of the user.",
Expand Down
3 changes: 2 additions & 1 deletion src/graphql/inputs/MutationUpdateCurrentUserInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ export const MutationUpdateCurrentUserInput = builder
description: "Primary education grade of the user.",
type: UserEducationGrade,
}),
emailAddress: t.string({
emailAddress: t.field({
description: "Email address of the user.",
type: "EmailAddress",
}),
employmentStatus: t.field({
description: "Employment status of the user.",
Expand Down
3 changes: 2 additions & 1 deletion src/graphql/inputs/MutationUpdateUserInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ export const MutationUpdateUserInput = builder
description: "Primary education grade of the user.",
type: UserEducationGrade,
}),
emailAddress: t.string({
emailAddress: t.field({
description: "Email address of the user.",
type: "EmailAddress",
}),
employmentStatus: t.field({
description: "Employment status of the user.",
Expand Down
3 changes: 2 additions & 1 deletion src/graphql/inputs/QuerySignInInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ export const QuerySignInInput = builder
.implement({
description: "",
fields: (t) => ({
emailAddress: t.string({
emailAddress: t.field({
description: "Email address of the user.",
required: true,
type: "EmailAddress",
}),
password: t.string({
description: "Password of the user to sign in to talawa.",
Expand Down
24 changes: 24 additions & 0 deletions src/graphql/scalars/EmailAddress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { EmailAddressResolver } from "graphql-scalars";
import { builder } from "~/src/graphql/builder";

/**
* A custom scalar type for validating email addresses according to RFC 5322.
* This ensures that all email fields in the schema are properly validated.
* More information at this link: {@link https://the-guild.dev/graphql/scalars/docs/scalars/email-address}
*/
export const EmailAddress = builder.addScalarType(
"EmailAddress",
EmailAddressResolver,
);

/**
* `EmailAddress` scalar type for pothos schema.
* The underscore prefix indicates this is an internal type definition.
* @example
* Valid: [email protected]
* Invalid: user@, [email protected], @example.com
*/
export type _EmailAddress = {
Input: string;
Output: string;
};
4 changes: 4 additions & 0 deletions src/graphql/scalars/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import "./Date";
import "./DateTime";
import "./PhoneNumber";
import "./Upload";
import "./EmailAddress";

import type { _BigInt } from "./BigInt";
import type { _Date } from "./Date";
import type { DateTime } from "./DateTime";
import type { _EmailAddress } from "./EmailAddress";
import type { PhoneNumber } from "./PhoneNumber";
import type { Upload } from "./Upload";

Expand All @@ -19,6 +21,7 @@ export type CustomScalars = {
DateTime: DateTime;
PhoneNumber: PhoneNumber;
Upload: Upload;
EmailAddress: _EmailAddress;
};

/**
Expand All @@ -29,4 +32,5 @@ export type ClientCustomScalars = {
Date: string;
DateTime: string;
PhoneNumber: string;
EmailAddress: string;
};
3 changes: 2 additions & 1 deletion src/graphql/types/User/emailAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { User } from "./User";

User.implement({
fields: (t) => ({
emailAddress: t.string({
emailAddress: t.field({
description: "Email address of the user.",
resolve: async (parent, _args, ctx) => {
if (!ctx.currentClient.isAuthenticated) {
Expand Down Expand Up @@ -44,6 +44,7 @@ User.implement({

return parent.emailAddress;
},
type: "EmailAddress",
}),
}),
});
2 changes: 1 addition & 1 deletion src/routes/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const graphql = fastifyPlugin(async (fastify) => {
fastify,
isSubscription: true,
request,
socket,
socket: socket as unknown as WebSocket,
}),
// Intervals in milli-seconds to wait before sending the `GQL_CONNECTION_KEEP_ALIVE` message to the client to check if the connection is alive. This helps detect disconnected subscription clients and prevent unnecessary data transfer.
keepAlive: 1000 * 30,
Expand Down
Loading

0 comments on commit 9c9dff1

Please sign in to comment.