Skip to content

Commit

Permalink
Feat/funds (#1664)
Browse files Browse the repository at this point in the history
* fix postByConnectionQuery

* Squashed commit of the following:

commit 6e157db
Author: Peter Harrison <[email protected]>
Date:   Wed Feb 28 13:49:06 2024 -0800

    Revert "Revert "feat: Integrated Dicebear Library To Enhance Security (#1585)…" (#1635)

    This reverts commit ebcc977.

commit ebcc977
Author: Peter Harrison <[email protected]>
Date:   Wed Feb 28 13:47:08 2024 -0800

    Revert "feat: Integrated Dicebear Library To Enhance Security (#1585)" (#1634)

    This reverts commit 7828c40.

commit da8df05
Author: Peter Harrison <[email protected]>
Date:   Wed Feb 28 13:46:19 2024 -0800

    Revert "Revert "feat: Add support for Action Items (#1596)" (#1632)" (#1633)

    This reverts commit 22bdfa9.

commit 22bdfa9
Author: Peter Harrison <[email protected]>
Date:   Wed Feb 28 13:44:15 2024 -0800

    Revert "feat: Add support for Action Items (#1596)" (#1632)

    This reverts commit a71db3b.

commit a71db3b
Author: Meetul Rathore <[email protected]>
Date:   Thu Feb 29 00:24:58 2024 +0530

    feat: Add support for Action Items (#1596)

    * add mutations and queries

    * add translations

    * add tests

    * add dropdown for toggling settings on small screens

    * minor corrections

    * minor change

    * initial changes

    * basic design

    * add basic modals

    * add create action item functionality

    * add update functionality

    * add delete functionality

    * add details modal

    * extract modals and restructure

    * add sorting

    * remove unnecessary files

    * add filters and design adjustments

    * add translations

    * don't show disabled action item categories

    * add tests for OrganizationActionItems.tsx

    * add tests for ActionItemContainer.tsx

    * add filters section

    * minor adjustments

    * move mutations and queries into separate files

    * fix failing test

    * format files

    * use css variables for colors

    * write test for IconComponent.tsx

commit 7828c40
Author: Akhilender Bongirwar <[email protected]>
Date:   Wed Feb 28 17:59:21 2024 +0530

    feat: Integrated Dicebear Library To Enhance Security (#1585)

    * feat: Integrated Dicebear Library To Enhance Security

    - Added the Dicebear library as a dependency to the project.
    - Imported the necessary functions from the library.
    - Created a new `Avatar` component that utilizes the Dicebear library locally.
    - Updated the component to accept `name`, `alt`, and `size` as props.
    - Utilized the Dicebear library to generate avatars with initials.
    - Removed direct HTTP API calls from the codebase.
    - Replaced instances of direct HTTP API calls with the newly created `Avatar` component.
    - Updated the exisiting tests and ensured the tests are still valid.
    - Mitigated security risks associated with SSRF and XSS attacks by eliminating direct HTTP API calls.
    - By using the Dicebear library locally, we reduce potential vulnerabilities.
    - Ensured no other functionality is affected.

    Signed-off-by: Akhilender <[email protected]>

    * fix: Reverted changes in the tests

    - Reverted the Avatar component in all the tests as they are redundant in tests except where it is needed.
    - Ensured all the remaning tests are succesfully passing.

    Signed-off-by: Akhilender <[email protected]>

    * fix: Added dynamic style

    - Handled case where no alt tag is provided by adding default alt value.
    - dynamic rendering for className for img tag in avatar component
    - Dynamic rendering for test-id
    - Replaced suitable changes for the above properties added

    Signed-off-by: Akhilender <[email protected]>

    * fix: modified test

    Signed-off-by: Akhilender <[email protected]>

    * fix: resolved conflict

    Signed-off-by: Akhilender <[email protected]>

    ---------

    Signed-off-by: Akhilender <[email protected]>

commit 092b9f6
Author: Disha Talreja <[email protected]>
Date:   Tue Feb 27 23:13:24 2024 +0530

    feat: implemented support to upload media while creating and updating advertisements (#1529)

    * feat: implemented support to upload media in advertisement register component

    * fix: failing tests

    * fix: failing tests

    * removed commented code

    * fix: failing tests

    * renamed link variable to mediaUrl

    * updated the type of mediaUrl

    * updated schema and mutation for createAdvertisement

    * removed unused variables

    * Added support to display advertisement image/video in user portal

    * fix: failing tests

    * fix: failing tests

    * reverted unwanted changes

    * fix: failing tests

    * fix: failing tests

    * added translations for different languages and improved variable names

    * Updated variable name and input fields for creating advertisements

    * fix: failing tests

    * fix: failing tests

    * updated get advertisement query

    * fix: update advertisement feature

    * removed unwanted curly braces

    * fix failing tests

    * updated type of file

    * fix: formatting issues

    * fix: formatting issues

    * updated variable name and fix cross origin error

    * removed: unwanted curly braces

    * fix: failing tests

    * added oragnization resolver for advertisement

    * removed unwanted code

    * fix: failing tests

    * fix: formatting issues

    * fix: formatting issues

    * fix: formatting issues

    * fix: failing tests

    * fix: advertisements not rendering

    * fix: removed unused imports

    * fix: linting errors

    * Update documentation

    * Updated mutation to delete advertisement

    * Update documentation

    * fix: formatting issues

    * fix: type error

    * fix: lint errors

    * fix: error

    * fix: advertisements not rendering on user portal

    * fix: not same origin error while rendering video

    * Updated deleteAdvertisement mutation and advertisementsConnection mutation

    * fix: failing tests

commit 9ffa02b
Author: Peter Harrison <[email protected]>
Date:   Tue Feb 27 09:19:26 2024 -0800

    Enforce Node v20

commit 9d2689a
Author: Anvita Mahajan <[email protected]>
Date:   Tue Feb 27 22:21:20 2024 +0530

    Increased code coverage for src/components/AddOn/core/AddOnStore/AddOnStore.tsx file (#1614)

    * Added tests for AddOnStore/AddOnStore.tsx

    * Fixed linting errors

    * Fixed warnings due to linting errors

    * Removed commented code

* fix formatting error

* fix

* added test

* created fund screen

* added update fund feature

* funds feature completed

* added tests

* fix test

* merged develop

* fix deletion error

* fix

* remove unwanted file

* remove unwanted file

* remove unwanted file

* added doc for remove fund mutation

* fixed eslint

* fixed eslint

* fix

* removed unwanted file

* fix formatting error

* fix faiing test
  • Loading branch information
AVtheking authored Mar 5, 2024
1 parent 4b01054 commit e186ed2
Show file tree
Hide file tree
Showing 22 changed files with 2,251 additions and 24 deletions.
28 changes: 28 additions & 0 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,34 @@
"eventUpdated": "Event updated successfully.",
"talawaApiUnavailable": "Talawa-API service is unavailable. Is it running? Check your network connectivity too."
},
"funds": {
"title": "Talawa Funds",
"createFund": "Create",
"fundName": "Fund Name",
"fundId": "Fund ID",
"fundOptions": "Opitons",
"noFunds": "No Funds Found",
"fundDetails": "Fund Details",
"taxDeductible": "Tax Deductible",
"enterfundName": "Enter Fund Name",
"enterfundId": "Enter Fund ID",
"default": "Default Fund",
"archived": "Archived",
"nonArchive": "Non-Archived",
"fundCreate": "Create Fund",
"fundUpdate": "Update Fund",
"fundDelete": "Delete Fund",
"no": "No",
"yes": "Yes",
"archiveFund": "Archive Fund",
"archiveFundMsg": "On Archiving this fund will remove it from the fund listing.Thisaction can be undone",
"fundCreated": "Fund created successfully",
"fundUpdated": "Fund updated successfully",
"fundDeleted": "Fund deleted successfully",
"fundArchived": "Fund archived successfully",
"fundUnarchived": "Fund unarchived successfully",
"deleteFundMsg": "Do you want to remove this fund?"
},
"orgPost": {
"title": "Talawa Posts",
"searchPost": "Search Post",
Expand Down
28 changes: 28 additions & 0 deletions public/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,34 @@
"eventUpdated": "Événement mis à jour avec succès.",
"talawaApiUnavailable": "Le service Talawa-API n'est pas disponible. Est-il en cours d'exécution ? Vérifiez également votre connectivité réseau."
},
"funds": {
"title": "Fonds Talawa",
"createFund": "Créer un fonds",
"fundName": "Nom du fonds",
"fundId": "Identifiant du fonds",
"fundOptions": "Options de fonds",
"noFunds": "Pas de fonds",
"fundDetails": "Détails du fonds",
"taxDeductible": "Déductible d'impôt",
"enterfundName": "Entrez le nom du fonds",
"enterfundId": "Entrez l'identifiant du fonds",
"default": "Défaut",
"archived": "Archivé",
"nonArchive": "Non archivé",
"fundCreate": "Créer un fonds",
"fundUpdate": "Mettre à jour le fonds",
"fundDelete": "Supprimer le fonds",
"no": "Non",
"yes": "Oui",
"archiveFund": "Archiver le fonds",
"archiveFundMsg": "Voulez-vous archiver ce fonds ?",
"fundCreated": "Fonds créé avec succès",
"fundUpdated": "Fonds mis à jour avec succès",
"fundDeleted": "Fonds supprimé avec succès",
"fundArchived": "Fonds archivé avec succès",
"fundUnarchived": "Fonds désarchivé avec succès",
"deleteFundMsg": "Voulez-vous supprimer ce fonds ?"
},
"orgPost": {
"title": "Talawa Publications",
"searchPost": "Rechercher une publication",
Expand Down
28 changes: 28 additions & 0 deletions public/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,34 @@
"eventUpdated": "इवेंट सफलतापूर्वक अपडेट किया गया।",
"talawaApiUnavailable": "तलवा-एपीआई सेवा उपलब्ध नहीं है। क्या यह चल रहा है? अपनी नेटवर्क कनेक्टिविटी भी जांचें।"
},
"funds": {
"title": "तलवा फंड्स",
"createFund": "फंड बनाएँ",
"fundName": "फंड का नाम",
"fundId": "फंड आईडी",
"fundOptions": "फंड विकल्प",
"noFunds": "कोई फंड नहीं",
"fundDetails": "फंड विवरण",
"taxDeductible": "कर कटौती",
"enterfundName": " फंड का नाम दर्ज करें",
"enterfundId": " फंड आईडी दर्ज करें",
"default": "डिफ़ॉल्ट",
"archived": "संग्रहीत",
"nonArchive": "गैर संग्रहीत",
"fundCreate": "फंड बनाएँ",
"fundUpdate": "फंड अपडेट करें",
"fundDelete": "फंड हटाएं",
"no": "नहीं",
"yes": "हाँ",
"archiveFund": "फंड संग्रहीत करें",
"archiveFundMsg": "क्या आप इस फंड को संग्रहीत करना चाहते हैं?",
"fundCreated": "फंड सफलतापूर्वक बनाया गया",
"fundUpdated": "फंड सफलतापूर्वक अपडेट किया गया",
"fundDeleted": "फंड सफलतापूर्वक हटाया गया",
"fundArchived": "फंड सफलतापूर्वक संग्रहीत किया गया",
"fundUnarchived": "फंड सफलतापूर्वक गैर संग्रहीत किया गया",
"deleteFundMsg": "क्या आप इस फंड को हटाना चाहते हैं?"
},
"orgPost": {
"title": "तलवा पोस्ट्स",
"searchPost": "पोस्ट खोजें",
Expand Down
29 changes: 29 additions & 0 deletions public/locales/sp.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,35 @@
"eventUpdated": "Evento actualizado con éxito.",
"talawaApiUnavailable": "El servicio Talawa-API no está disponible. ¿Está funcionando? Compruebe también la conectividad de su red."
},
"funds": {
"title": "Fondos de Talawa",
"createFund": "Crear",
"fundName": "Nombre del Fondo",
"fundId": "ID del Fondo",
"fundOptions": "Opciones",
"noFunds": "No se encontraron fondos",
"fundDetails": "Detalles del Fondo",
"taxDeductible": "Deducible de impuestos",
"enterfundName": "Ingrese el nombre del fondo",
"enterfundId": "Ingrese el ID del fondo",
"default": "Fondo predeterminado",
"archived": "Archivado",
"nonArchive": "No archivado",
"fundCreate": "Crear Fondo",
"fundUpdate": "Actualizar Fondo",
"fundDelete": "Eliminar Fondo",
"no": "No",
"yes": "",
"archiveFund": "Archivar Fondo",
"archiveFundMsg": "¿Desea archivar este fondo?",
"fundCreated": "Fondo creado exitosamente",
"fundUpdated": "Fondo actualizado exitosamente",
"fundDeleted": "Fondo eliminado exitosamente",
"fundArchived": "Fondo archivado exitosamente",
"fundUnarchived": "Fondo no archivado exitosamente",
"deleteFundMsg": "¿Desea eliminar este fondo?"
},

"orgPost": {
"title": "Publicaciones de Talawa",
"searchPost": "Buscar Publicación",
Expand Down
29 changes: 29 additions & 0 deletions public/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,35 @@
"noNotifications": "沒有通知",
"close": ""
},
"funds": {
"title": "塔拉瓦基金",
"createFund": "创建",
"fundName": "基金名称",
"fundId": "基金ID",
"fundOptions": "选项",
"noFunds": "未找到基金",
"fundDetails": "基金详情",
"taxDeductible": "允许税收扣除",
"enterfundName": " 输入基金名称",
"enterfundId": "输入基金ID",
"default": "默认基金",
"archived": "已归档",
"nonArchive": "未归档",
"fundCreate": "创建基金",
"fundUpdate": "更新基金",
"fundDelete": "删除基金",
"no": "",
"yes": "",
"archiveFund": "归档基金",
"archiveFundMsg": "您是否要归档此基金?",
"fundCreated": "基金创建成功",
"fundUpdated": "基金更新成功",
"fundDeleted": "基金删除成功",
"fundArchived": "基金已归档",
"fundUnarchived": "基金未归档",
"deleteFundMsg": "您是否要删除此基金?"
},

"orgList": {
"title": "塔拉瓦組織",
"you": "",
Expand Down
36 changes: 20 additions & 16 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
import React, { useEffect } from 'react';
import { Route, Switch } from 'react-router-dom';
/* eslint-disable */
import { useQuery } from '@apollo/client';
import * as installedPlugins from 'components/plugins/index';
import { CHECK_AUTH } from 'GraphQl/Queries/Queries';
import AddOnStore from 'components/AddOn/core/AddOnStore/AddOnStore';
import Loader from 'components/Loader/Loader';
import SecuredRoute from 'components/SecuredRoute/SecuredRoute';
import SecuredRouteForUser from 'components/UserPortal/SecuredRouteForUser/SecuredRouteForUser';
import * as installedPlugins from 'components/plugins/index';
import React, { useEffect } from 'react';
import { Route, Switch } from 'react-router-dom';
import BlockUser from 'screens/BlockUser/BlockUser';
import EventDashboard from 'screens/EventDashboard/EventDashboard';
import ForgotPassword from 'screens/ForgotPassword/ForgotPassword';
import LoginPage from 'screens/LoginPage/LoginPage';
import OrganizationEvents from 'screens/OrganizationEvents/OrganizationEvents';
import OrganizationActionItems from 'screens/OrganizationActionItems/OrganizationActionItems';
import OrganizationPeople from 'screens/OrganizationPeople/OrganizationPeople';
import OrganizationDashboard from 'screens/OrganizationDashboard/OrganizationDashboard';
import MemberDetail from 'screens/MemberDetail/MemberDetail';
import OrgContribution from 'screens/OrgContribution/OrgContribution';
import OrgList from 'screens/OrgList/OrgList';
import OrgPost from 'screens/OrgPost/OrgPost';
import OrgSettings from 'screens/OrgSettings/OrgSettings';
import OrganizationActionItems from 'screens/OrganizationActionItems/OrganizationActionItems';
import OrganizationDashboard from 'screens/OrganizationDashboard/OrganizationDashboard';
import OrganizationEvents from 'screens/OrganizationEvents/OrganizationEvents';
import OrganizationFunds from 'screens/OrganizationFunds/OrganizationFunds';
import OrganizationPeople from 'screens/OrganizationPeople/OrganizationPeople';
import PageNotFound from 'screens/PageNotFound/PageNotFound';
import AddOnStore from 'components/AddOn/core/AddOnStore/AddOnStore';
import ForgotPassword from 'screens/ForgotPassword/ForgotPassword';
import Users from 'screens/Users/Users';
import BlockUser from 'screens/BlockUser/BlockUser';
import EventDashboard from 'screens/EventDashboard/EventDashboard';
import MemberDetail from 'screens/MemberDetail/MemberDetail';
import Loader from 'components/Loader/Loader';

// User Portal Components
import Organizations from 'screens/UserPortal/Organizations/Organizations';
import Donate from 'screens/UserPortal/Donate/Donate';
import Events from 'screens/UserPortal/Events/Events';
import Home from 'screens/UserPortal/Home/Home';
import Organizations from 'screens/UserPortal/Organizations/Organizations';
import People from 'screens/UserPortal/People/People';
import Settings from 'screens/UserPortal/Settings/Settings';
import Donate from 'screens/UserPortal/Donate/Donate';
import Events from 'screens/UserPortal/Events/Events';
// import UserLoginPage from 'screens/UserPortal/UserLoginPage/UserLoginPage';
// import Chat from 'screens/UserPortal/Chat/Chat';
import Advertisements from 'components/Advertisements/Advertisements';
import useLocalStorage from 'utils/useLocalstorage';
Expand Down Expand Up @@ -107,6 +110,7 @@ function app(): JSX.Element {
path="/orgactionitems"
component={OrganizationActionItems}
/>
<SecuredRoute path="/orgfunds" component={OrganizationFunds} />
<SecuredRoute path="/orgcontribution" component={OrgContribution} />
<SecuredRoute path="/orgpost" component={OrgPost} />
<SecuredRoute path="/orgsetting" component={OrgSettings} />
Expand Down
82 changes: 82 additions & 0 deletions src/GraphQl/Mutations/FundMutation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import gql from 'graphql-tag';

/**
* GraphQL mutation to create a new fund.
*
* @param name - The name of the fund.
* @param organizationId - The organization ID the fund is associated with.
* @param refrenceNumber - The reference number of the fund.
* @param taxDeductible - Whether the fund is tax deductible.
* @param isArchived - Whether the fund is archived.
* @param isDefault - Whether the fund is the default.
* @returns The ID of the created fund.
*/
export const CREATE_FUND_MUTATION = gql`
mutation CreateFund(
$name: String!
$organizationId: ID!
$refrenceNumber: String
$taxDeductible: Boolean!
$isArchived: Boolean!
$isDefault: Boolean!
) {
createFund(
data: {
name: $name
organizationId: $organizationId
refrenceNumber: $refrenceNumber
taxDeductible: $taxDeductible
isArchived: $isArchived
isDefault: $isDefault
}
) {
_id
}
}
`;

/**
* GraphQL mutation to update a fund.
*
* @param id - The ID of the fund being updated.
* @param name - The name of the fund.
* @param taxDeductible - Whether the fund is tax deductible.
* @param isArchived - Whether the fund is archived.
* @param isDefault - Whether the fund is the default.
* @returns The ID of the updated fund.
*/
export const UPDATE_FUND_MUTATION = gql`
mutation UpdateFund(
$id: ID!
$name: String
$taxDeductible: Boolean
$isArchived: Boolean
$isDefault: Boolean
) {
updateFund(
id: $id
data: {
name: $name
taxDeductible: $taxDeductible
isArchived: $isArchived
isDefault: $isDefault
}
) {
_id
}
}
`;

/**
* GraphQL mutation to remove a fund.
*
* @param id - The ID of the fund being removed.
* @returns The ID of the removed fund.
*/
export const REMOVE_FUND_MUTATION = gql`
mutation RemoveFund($id: ID!) {
removeFund(id: $id) {
_id
}
}
`;
22 changes: 22 additions & 0 deletions src/GraphQl/Queries/OrganizationQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,25 @@ export const ORGANIZATION_ADMINS_LIST = gql`
}
}
`;

/**
* GraphQL query to retrieve the list of members for a specific organization.
*
* @param id - The ID of the organization for which members are being retrieved.
* @returns The list of members associated with the organization.
*/
export const ORGANIZATION_FUNDS = gql`
query Organizations($id: ID!) {
organizations(id: $id) {
funds {
_id
name
refrenceNumber
taxDeductible
isArchived
isDefault
createdAt
}
}
}
`;
1 change: 1 addition & 0 deletions src/assets/svgs/funds.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions src/components/IconComponent/IconComponent.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import IconComponent from './IconComponent';

import React from 'react';
const screenTestIdMap: Record<string, Record<string, string>> = {
Dashboard: {
name: 'Dashboard',
Expand All @@ -23,6 +22,10 @@ const screenTestIdMap: Record<string, Record<string, string>> = {
name: 'Posts',
testId: 'Icon-Component-PostsIcon',
},
Funds: {
name: 'Funds',
testId: 'Icon-Component-Funds',
},
BlockUnblock: {
name: 'Block/Unblock',
testId: 'Block/Icon-Component-UnblockIcon',
Expand Down
Loading

0 comments on commit e186ed2

Please sign in to comment.