Skip to content

Commit

Permalink
Merge branch 'develop' into 2262
Browse files Browse the repository at this point in the history
  • Loading branch information
prayanshchh authored Sep 7, 2024
2 parents a8478c4 + 0e711c6 commit c947850
Show file tree
Hide file tree
Showing 45 changed files with 379 additions and 668 deletions.
19 changes: 15 additions & 4 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ directive @role(requires: UserType) on FIELD_DEFINITION
type ActionItem {
_id: ID!
actionItemCategory: ActionItemCategory
allotedHours: Float
assignee: User
assigner: User
assignmentDate: Date!
Expand All @@ -29,16 +30,24 @@ type ActionItemCategory {
updatedAt: Date!
}

input ActionItemCategoryWhereInput {
is_disabled: Boolean
name_contains: String
}

input ActionItemWhereInput {
actionItemCategory_id: ID
assigneeName: String
categoryName: String
event_id: ID
is_active: Boolean
is_completed: Boolean
}

enum ActionItemsOrderByInput {
createdAt_ASC
createdAt_DESC
dueDate_ASC
dueDate_DESC
}

type Address {
Expand Down Expand Up @@ -269,6 +278,7 @@ interface ConnectionPageInfo {
scalar CountryCode

input CreateActionItemInput {
allotedHours: Float
assigneeId: ID!
dueDate: Date
eventId: ID
Expand Down Expand Up @@ -1080,7 +1090,7 @@ type Mutation {
checkIn(data: CheckInCheckOutInput!): CheckIn!
checkOut(data: CheckInCheckOutInput!): CheckOut!
createActionItem(actionItemCategoryId: ID!, data: CreateActionItemInput!): ActionItem!
createActionItemCategory(name: String!, organizationId: ID!): ActionItemCategory!
createActionItemCategory(isDisabled: Boolean!, name: String!, organizationId: ID!): ActionItemCategory!
createAdmin(data: UserAndOrganizationInput!): CreateAdminPayload!
createAdvertisement(input: CreateAdvertisementInput!): CreateAdvertisementPayload
createAgendaCategory(input: CreateAgendaCategoryInput!): AgendaCategory!
Expand Down Expand Up @@ -1476,9 +1486,9 @@ type PostsConnection {
}

type Query {
actionItemCategoriesByOrganization(organizationId: ID!): [ActionItemCategory]
actionItemCategoriesByOrganization(orderBy: ActionItemsOrderByInput, organizationId: ID!, where: ActionItemCategoryWhereInput): [ActionItemCategory]
actionItemsByEvent(eventId: ID!): [ActionItem]
actionItemsByOrganization(orderBy: ActionItemsOrderByInput, organizationId: ID!, where: ActionItemWhereInput): [ActionItem]
actionItemsByOrganization(eventId: ID, orderBy: ActionItemsOrderByInput, organizationId: ID!, where: ActionItemWhereInput): [ActionItem]
adminPlugin(orgId: ID!): [Plugin]
advertisementsConnection(after: String, before: String, first: PositiveInt, last: PositiveInt): AdvertisementsConnection
agendaCategory(id: ID!): AgendaCategory!
Expand Down Expand Up @@ -1661,6 +1671,7 @@ input UpdateActionItemCategoryInput {
}

input UpdateActionItemInput {
allotedHours: Float
assigneeId: ID
completionDate: Date
dueDate: Date
Expand Down
45 changes: 30 additions & 15 deletions src/models/ActionItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,63 @@ import type { InterfaceUser } from "./User";
import type { InterfaceEvent } from "./Event";
import type { InterfaceActionItemCategory } from "./ActionItemCategory";
import { MILLISECONDS_IN_A_WEEK } from "../constants";
import type { InterfaceOrganization } from "./Organization";

/**
* Interface representing a database document for ActionItem in MongoDB.
*/
export interface InterfaceActionItem {
_id: Types.ObjectId;
assigneeId: PopulatedDoc<InterfaceUser & Document>;
assignerId: PopulatedDoc<InterfaceUser & Document>;
actionItemCategoryId: PopulatedDoc<InterfaceActionItemCategory & Document>;
assignee: PopulatedDoc<InterfaceUser & Document>;
assigner: PopulatedDoc<InterfaceUser & Document>;
actionItemCategory: PopulatedDoc<
InterfaceActionItemCategory & Document
> | null;
preCompletionNotes: string;
postCompletionNotes: string;
assignmentDate: Date;
dueDate: Date;
completionDate: Date;
isCompleted: boolean;
eventId: PopulatedDoc<InterfaceEvent & Document>;
creatorId: PopulatedDoc<InterfaceUser & Document>;
allotedHours: number | null;
organization: PopulatedDoc<InterfaceOrganization & Document>;
event: PopulatedDoc<InterfaceEvent & Document>;
creator: PopulatedDoc<InterfaceUser & Document>;
createdAt: Date;
updatedAt: Date;
}

/**
* Defines the schema for the ActionItem document.
* @param assigneeId - User to whom the ActionItem is assigned.
* @param assignerId - User who assigned the ActionItem.
* @param actionItemCategoryId - ActionItemCategory to which the ActionItem belongs.
* @param assignee - User to whom the ActionItem is assigned.
* @param assigner - User who assigned the ActionItem.
* @param actionItemCategory - ActionItemCategory to which the ActionItem belongs.
* @param preCompletionNotes - Notes recorded before completion.
* @param postCompletionNotes - Notes recorded after completion.
* @param assignmentDate - Date when the ActionItem was assigned.
* @param dueDate - Due date for the ActionItem.
* @param completionDate - Date when the ActionItem was completed.
* @param isCompleted - Flag indicating if the ActionItem is completed.
* @param eventId - Optional: Event to which the ActionItem is related.
* @param creatorId - User who created the ActionItem.
* @param allotedHours - Optional: Number of hours alloted for the ActionItem.
* @param event - Optional: Event to which the ActionItem is related.
* @param organization - Organization to which the ActionItem belongs.
* @param creator - User who created the ActionItem.
* @param createdAt - Timestamp when the ActionItem was created.
* @param updatedAt - Timestamp when the ActionItem was last updated.
*/
const actionItemSchema = new Schema(
{
assigneeId: {
assignee: {
type: Schema.Types.ObjectId,
ref: "User",
required: true,
},
assignerId: {
assigner: {
type: Schema.Types.ObjectId,
ref: "User",
required: true,
},
actionItemCategoryId: {
actionItemCategory: {
type: Schema.Types.ObjectId,
ref: "ActionItemCategory",
required: true,
Expand Down Expand Up @@ -84,11 +91,19 @@ const actionItemSchema = new Schema(
required: true,
default: false,
},
eventId: {
allotedHours: {
type: Number,
},
organization: {
type: Schema.Types.ObjectId,
ref: "Organization",
required: true,
},
event: {
type: Schema.Types.ObjectId,
ref: "Event",
},
creatorId: {
creator: {
type: Schema.Types.ObjectId,
ref: "User",
required: true,
Expand Down
14 changes: 0 additions & 14 deletions src/resolvers/ActionItem/actionItemCategory.ts

This file was deleted.

22 changes: 0 additions & 22 deletions src/resolvers/ActionItem/assignee.ts

This file was deleted.

19 changes: 0 additions & 19 deletions src/resolvers/ActionItem/assigner.ts

This file was deleted.

28 changes: 0 additions & 28 deletions src/resolvers/ActionItem/creator.ts

This file was deleted.

32 changes: 0 additions & 32 deletions src/resolvers/ActionItem/event.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/resolvers/ActionItem/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/resolvers/ActionItemCategory/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { ActionItemCategoryResolvers } from "../../types/generatedGraphQLTypes";
import { organization } from "./organization";
import { creator } from "./creator";

export const ActionItemCategory: ActionItemCategoryResolvers = {
organization,
creator,
};
30 changes: 0 additions & 30 deletions src/resolvers/ActionItemCategory/organization.ts

This file was deleted.

12 changes: 7 additions & 5 deletions src/resolvers/Mutation/createActionItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,15 @@ export const createActionItem: MutationResolvers["createActionItem"] = async (

// Creates and returns the new action item.
const createActionItem = await ActionItem.create({
assigneeId: args.data.assigneeId,
assignerId: context.userId,
actionItemCategoryId: args.actionItemCategoryId,
assignee: args.data.assigneeId,
assigner: context.userId,
actionItemCategory: args.actionItemCategoryId,
preCompletionNotes: args.data.preCompletionNotes,
allotedHours: args.data.allotedHours,
dueDate: args.data.dueDate,
eventId: args.data.eventId,
creatorId: context.userId,
event: args.data.eventId,
organization: actionItemCategory.organizationId,
creator: context.userId,
});

return createActionItem.toObject();
Expand Down
1 change: 1 addition & 0 deletions src/resolvers/Mutation/createActionItemCategory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export const createActionItemCategory: MutationResolvers["createActionItemCatego
// Creates new actionItemCategory.
const createdActionItemCategory = await ActionItemCategory.create({
name: args.name,
isDisabled: args.isDisabled,
organizationId: args.organizationId,
creatorId: context.userId,
});
Expand Down
Loading

0 comments on commit c947850

Please sign in to comment.