Skip to content

Commit

Permalink
Updating the main branch to the latest develop code (#2329)
Browse files Browse the repository at this point in the history
* Deleted all files in the main branch in anticipation of merging develop into main cleanly

* Merge develop into main

---------

Co-authored-by: Peter Harrison <[email protected]>
  • Loading branch information
palisadoes and Peter Harrison authored Jun 2, 2024
1 parent e7dbca3 commit fe940d9
Show file tree
Hide file tree
Showing 19 changed files with 458 additions and 399 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,3 @@ Core features include:

1. Visit our [YouTube Channel playlists](https://www.youtube.com/@PalisadoesOrganization/playlists) for more insights
1. The "Getting Started - Developers" videos are extremely helpful for new open source contributors.

629 changes: 266 additions & 363 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
"@graphql-inspector/cli": "^4.0.3",
"@graphql-tools/resolvers-composition": "^7.0.1",
"@graphql-tools/schema": "^10.0.0",
"@graphql-tools/utils": "^10.1.3",
"@graphql-tools/utils": "^10.2.0",
"@parcel/watcher": "^2.4.1",
"@types/graphql-upload": "^16.0.5",
"@types/yargs": "^17.0.32",
"axios": "^1.6.8",
"axios": "^1.7.2",
"bcryptjs": "^2.4.3",
"bluebird": "3.7.2",
"cls-hooked": "^4.2.2",
Expand Down Expand Up @@ -82,26 +82,26 @@
"markdown-toc": "^1.2.0",
"mongodb": "^6.3.0",
"mongoose": "^8.3.2",
"mongoose-paginate-v2": "^1.8.0",
"mongoose-paginate-v2": "^1.8.1",
"morgan": "^1.10.0",
"nanoid": "^5.0.7",
"nodemailer": "^6.9.12",
"pm2": "^5.2.0",
"redis": "^4.6.13",
"redis": "^4.6.14",
"rrule": "^2.8.1",
"typedoc-plugin-markdown": "^3.17.1",
"typedoc-plugin-markdown": "^4.0.1",
"uuid": "^9.0.0",
"validator": "^13.7.0",
"validator": "^13.12.0",
"winston": "^3.13.0",
"ws": "^8.15.0",
"ws": "^8.17.0",
"yargs": "^17.7.2",
"zod": "^3.22.3",
"zod": "^3.23.8",
"zod-error": "^1.5.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/typescript": "^4.0.6",
"@graphql-codegen/typescript-resolvers": "^4.0.6",
"@graphql-codegen/typescript": "^4.0.7",
"@graphql-codegen/typescript-resolvers": "^4.1.0",
"@graphql-eslint/eslint-plugin": "^3.20.1",
"@parcel/watcher": "^2.4.1",
"@types/bcryptjs": "^2.4.6",
Expand All @@ -114,16 +114,16 @@
"@types/i18n": "^0.13.12",
"@types/inquirer": "^9.0.7",
"@types/jsonwebtoken": "^9.0.5",
"@types/lodash": "^4.17.0",
"@types/lodash": "^4.17.4",
"@types/mongoose-paginate-v2": "^1.6.5",
"@types/morgan": "^1.9.9",
"@types/node": "^20.12.7",
"@types/nodemailer": "^6.4.14",
"@types/nodemailer": "^6.4.15",
"@types/uuid": "^9.0.7",
"@types/validator": "^13.11.9",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"@vitest/coverage-v8": "^1.5.2",
"@types/validator": "^13.11.10",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"@vitest/coverage-v8": "^1.6.0",
"cls-bluebird": "^2.1.0",
"concurrently": "^8.2.2",
"eslint": "^8.56.0",
Expand All @@ -135,7 +135,7 @@
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"rimraf": "^5.0.7",
"tsx": "^4.7.3",
"typescript": "^5.4.5",
"vitest": "^1.2.1"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==24.3.0
black==22.12.0
pydocstyle==6.3.0
pylint==2.15.10
pymongo==4.3.3
Expand Down
3 changes: 3 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,7 @@ type Query {
adminPlugin(orgId: ID!): [Plugin]
advertisementsConnection(after: String, before: String, first: PositiveInt, last: PositiveInt): AdvertisementsConnection
agendaCategory(id: ID!): AgendaCategory!
agendaItemCategoriesByOrganization(organizationId: ID!): [AgendaCategory]
checkAuth: User!
customDataByOrganization(organizationId: ID!): [UserCustomData!]!
customFieldsByOrganization(id: ID!): [OrganizationCustomField]
Expand Down Expand Up @@ -1829,6 +1830,8 @@ type UserNotFoundError implements Error {
}

enum UserOrderByInput {
createdAt_ASC
createdAt_DESC
email_ASC
email_DESC
firstName_ASC
Expand Down
6 changes: 3 additions & 3 deletions setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ export async function twoFactorAuth(): Promise<void> {
type: "input",
name: "email",
message: "Enter your email:",
validate: (input: string) =>
validate: (input: string): string | boolean =>
isValidEmail(input) || "Invalid email. Please try again.",
},
{
Expand Down Expand Up @@ -860,7 +860,7 @@ async function main(): Promise<void> {
type: "input",
name: "serverPort",
message: "Enter the server port:",
default: 4000,
default: process.env.SERVER_PORT || 4000,
},
]);
if (process.env.NODE_ENV === "development") {
Expand Down Expand Up @@ -945,7 +945,7 @@ async function main(): Promise<void> {
MAXIMUM_IMAGE_SIZE_LIMIT_KB / 1000
}`,
default: 3,
validate: (input: number) =>
validate: (input: number): boolean | string =>
validateImageFileSize(input) ||
`Enter a valid number between 0 and ${
MAXIMUM_IMAGE_SIZE_LIMIT_KB / 1000
Expand Down
6 changes: 4 additions & 2 deletions src/resolvers/FundraisingCampagin/campaignPledges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const pledges: FundraisingCampaignResolvers["pledges"] = async (
parent,
) => {
return await FundraisingCampaignPledge.find({
campaignId: parent._id,
}).lean();
campaigns: parent._id,
})
.populate("users")
.lean();
};
5 changes: 4 additions & 1 deletion src/resolvers/Mutation/removeAgendaSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ export const removeAgendaSection: MutationResolvers["removeAgendaSection"] =

// Check if the current user is the creator of the agenda section or is a superadmin
if (
!agendaSection.createdBy.equals(currentUser._id) &&
!(
agendaSection.createdBy &&
agendaSection.createdBy.equals(currentUser._id)
) &&
!currentUserAppProfile.isSuperAdmin
) {
throw new errors.UnauthorizedError(
Expand Down
5 changes: 4 additions & 1 deletion src/resolvers/Mutation/updateAgendaSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ export const updateAgendaSection: MutationResolvers["updateAgendaSection"] =

// Check if the current user is the creator of the agenda section or is a superadmin
if (
!agendaSection.createdBy.equals(currentUser._id) &&
!(
agendaSection.createdBy &&
agendaSection.createdBy.equals(currentUser._id)
) &&
!currentUserAppProfile.isSuperAdmin
) {
throw new errors.UnauthorizedError(
Expand Down
17 changes: 15 additions & 2 deletions src/resolvers/Organization/posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ import { MAXIMUM_FETCH_LIMIT } from "../../constants";
*
* @throws GraphQLError Throws an error if the provided arguments are invalid.
*/
export const posts: OrganizationResolvers["posts"] = async (parent, args) => {
export const posts: OrganizationResolvers["posts"] = async (
parent,
args,
context,
) => {
const parseGraphQLConnectionArgumentsResult =
await parseGraphQLConnectionArguments({
args,
Expand Down Expand Up @@ -75,12 +79,21 @@ export const posts: OrganizationResolvers["posts"] = async (parent, args) => {
.countDocuments()
.exec(),
]);
const posts = objectList.map((post: InterfacePost) => ({
...post,
imageUrl: post.imageUrl
? new URL(post.imageUrl, context.apiRootUrl).toString()
: null,
videoUrl: post.videoUrl
? new URL(post.videoUrl, context.apiRootUrl).toString()
: null,
}));
return transformToDefaultGraphQLConnection<
ParsedCursor,
InterfacePost,
InterfacePost
>({
objectList,
objectList: posts,
parsedArgs,
totalCount,
});
Expand Down
14 changes: 14 additions & 0 deletions src/resolvers/Query/agendaItemCategoriesByOrganization.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { QueryResolvers } from "../../types/generatedGraphQLTypes";
import { AgendaCategoryModel } from "../../models";
/**
* This query will fetch all categories for the organization from database.
* @param _parent-
* @param args - An object that contains `organizationId` which is the _id of the Organization.
* @returns A `categories` object that holds all categories for the Organization.
*/
export const agendaItemCategoriesByOrganization: QueryResolvers["agendaItemCategoriesByOrganization"] =
async (_parent, args) => {
return await AgendaCategoryModel.find({
organizationId: args.organizationId,
}).lean();
};
6 changes: 6 additions & 0 deletions src/resolvers/Query/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { actionItemsByEvent } from "./actionItemsByEvent";
import { actionItemsByOrganization } from "./actionItemsByOrganization";
import { advertisementsConnection } from "./advertisementsConnection";
import { agendaCategory } from "./agendaCategory";
import { agendaItemCategoriesByOrganization } from "./agendaItemCategoriesByOrganization";
import { getAgendaItem } from "./agendaItemById";
import { getAgendaSection } from "./getAgendaSection";
import { checkAuth } from "./checkAuth";
import { customDataByOrganization } from "./customDataByOrganization";
import { customFieldsByOrganization } from "./customFieldsByOrganization";
Expand All @@ -22,6 +24,7 @@ import { getDonationById } from "./getDonationById";
import { getDonationByOrgId } from "./getDonationByOrgId";
import { getDonationByOrgIdConnection } from "./getDonationByOrgIdConnection";
import { getFundById } from "./getFundById";
import { getFundraisingCampaignById } from "./getFundraisingCampaign";
import { getPlugins } from "./getPlugins";
import { getlanguage } from "./getlanguage";
import { me } from "./me";
Expand All @@ -45,9 +48,11 @@ export const Query: QueryResolvers = {
actionItemsByEvent,
agendaCategory,
getAgendaItem,
getAgendaSection,
getAllAgendaItems,
actionItemsByOrganization,
actionItemCategoriesByOrganization,
agendaItemCategoriesByOrganization,
checkAuth,
getCommunityData,
customFieldsByOrganization,
Expand Down Expand Up @@ -79,6 +84,7 @@ export const Query: QueryResolvers = {
users,
usersConnection,
getFundById,
getFundraisingCampaignById,
venue,
fundsByOrganization,
getEventAttendee,
Expand Down
6 changes: 6 additions & 0 deletions src/resolvers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import GraphQLUpload from "graphql-upload/GraphQLUpload.mjs";
import type { Resolvers } from "../types/generatedGraphQLTypes";
import { ActionItem } from "./ActionItem";
import { ActionItemCategory } from "./ActionItemCategory";
import { AgendaItem } from "./AgendaItem";
import { AgendaSection } from "./AgendaSection";
import { AgendaCategory } from "./AgendaCategory";
import { CheckIn } from "./CheckIn";
import { Comment } from "./Comment";
import { DirectChat } from "./DirectChat";
Expand Down Expand Up @@ -44,6 +47,9 @@ import { currentUserExists } from "./middleware/currentUserExists";
const resolvers: Resolvers = {
ActionItem,
ActionItemCategory,
AgendaItem,
AgendaSection,
AgendaCategory,
Advertisement,
CheckIn,
Comment,
Expand Down
2 changes: 2 additions & 0 deletions src/typeDefs/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export const enums = gql`
lastName_DESC
email_ASC
email_DESC
createdAt_ASC
createdAt_DESC
}
enum UserType {
Expand Down
3 changes: 3 additions & 0 deletions src/typeDefs/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export const queries = gql`
actionItemCategoriesByOrganization(
organizationId: ID!
): [ActionItemCategory]
agendaItemCategoriesByOrganization(organizationId: ID!): [AgendaCategory]
getAgendaItem(id: ID!): AgendaItem
getAllAgendaItems: [AgendaItem]
Expand Down
9 changes: 9 additions & 0 deletions src/types/generatedGraphQLTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2229,6 +2229,7 @@ export type Query = {
adminPlugin?: Maybe<Array<Maybe<Plugin>>>;
advertisementsConnection?: Maybe<AdvertisementsConnection>;
agendaCategory: AgendaCategory;
agendaItemCategoriesByOrganization?: Maybe<Array<Maybe<AgendaCategory>>>;
checkAuth: User;
customDataByOrganization: Array<UserCustomData>;
customFieldsByOrganization?: Maybe<Array<Maybe<OrganizationCustomField>>>;
Expand Down Expand Up @@ -2312,6 +2313,11 @@ export type QueryAgendaCategoryArgs = {
};


export type QueryAgendaItemCategoriesByOrganizationArgs = {
organizationId: Scalars['ID']['input'];
};


export type QueryCustomDataByOrganizationArgs = {
organizationId: Scalars['ID']['input'];
};
Expand Down Expand Up @@ -2907,6 +2913,8 @@ export type UserNotFoundError = Error & {
};

export type UserOrderByInput =
| 'createdAt_ASC'
| 'createdAt_DESC'
| 'email_ASC'
| 'email_DESC'
| 'firstName_ASC'
Expand Down Expand Up @@ -4442,6 +4450,7 @@ export type QueryResolvers<ContextType = any, ParentType extends ResolversParent
adminPlugin?: Resolver<Maybe<Array<Maybe<ResolversTypes['Plugin']>>>, ParentType, ContextType, RequireFields<QueryAdminPluginArgs, 'orgId'>>;
advertisementsConnection?: Resolver<Maybe<ResolversTypes['AdvertisementsConnection']>, ParentType, ContextType, Partial<QueryAdvertisementsConnectionArgs>>;
agendaCategory?: Resolver<ResolversTypes['AgendaCategory'], ParentType, ContextType, RequireFields<QueryAgendaCategoryArgs, 'id'>>;
agendaItemCategoriesByOrganization?: Resolver<Maybe<Array<Maybe<ResolversTypes['AgendaCategory']>>>, ParentType, ContextType, RequireFields<QueryAgendaItemCategoriesByOrganizationArgs, 'organizationId'>>;
checkAuth?: Resolver<ResolversTypes['User'], ParentType, ContextType>;
customDataByOrganization?: Resolver<Array<ResolversTypes['UserCustomData']>, ParentType, ContextType, RequireFields<QueryCustomDataByOrganizationArgs, 'organizationId'>>;
customFieldsByOrganization?: Resolver<Maybe<Array<Maybe<ResolversTypes['OrganizationCustomField']>>>, ParentType, ContextType, RequireFields<QueryCustomFieldsByOrganizationArgs, 'id'>>;
Expand Down
2 changes: 1 addition & 1 deletion tests/resolvers/FundraisingCampaign/pledge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("resolvers->FundrasingCampaign->pledge", () => {
if (parent) {
const pledgesPayload = await pledgesResolver?.(parent, {}, {});
const pledges = await FundraisingCampaignPledge.find({
campaignId: testFundCampaigns?._id,
campaigns: testFundCampaigns?._id,
}).lean();
expect(pledgesPayload).toEqual(pledges);
}
Expand Down
Loading

0 comments on commit fe940d9

Please sign in to comment.