diff --git a/__mocks__/handlers/idle-users.handler.js b/__mocks__/handlers/idle-users.handler.js
new file mode 100644
index 000000000..2d17b8934
--- /dev/null
+++ b/__mocks__/handlers/idle-users.handler.js
@@ -0,0 +1,70 @@
+import { rest } from 'msw';
+const URL = process.env.NEXT_PUBLIC_BASE_URL;
+
+const idleUsersHandler = [
+ rest.get(`${URL}/users/search?state=IDLE`, (_, res, ctx) => {
+ return res(
+ ctx.status(200),
+ ctx.json({
+ message: 'Users found successfully!',
+ users: [
+ {
+ id: '26gZFJaXRfd8ghb3p0at',
+ discordId: '759647978121068544',
+ last_name: 'reddy',
+ first_name: 'chandra',
+ updated_at: 1695404825067,
+ username: 'chandra',
+ picture: {
+ url: 'https://res.cloudinary.com/realdevsquad/image/upload/v1689296550/profile/It0BbP0M2Wh8vdWUmMJB/a4j7tbh4g5ccbfepss88.jpg',
+ },
+ roles: {
+ archived: false,
+ in_discord: true,
+ member: false,
+ },
+ },
+ {
+ id: '2iaxlIok0itcIhD0zlsT',
+ discordId: '824562502310035487',
+ last_name: 'joy',
+ first_name: 'khushi',
+ roles: {
+ archived: false,
+ },
+ updated_at: 1695404825078,
+ username: 'khushi',
+ },
+ {
+ id: '3KeWfLRLN98L0QGv0hdL',
+ discordId: '619787720713175040',
+ roles: {
+ archived: false,
+ },
+ last_name: 'b',
+ first_name: 'pronoy',
+ updated_at: 1695404825079,
+ username: 'pronoy',
+ },
+ ],
+ count: 3,
+ })
+ );
+ }),
+];
+
+export const failedIdleUsersHandler = rest.get(
+ `${URL}/users/search?state=IDLE`,
+ (_, res, ctx) => {
+ return res(
+ ctx.status(500),
+ ctx.json({
+ statusCode: 500,
+ error: 'Internal Server Error',
+ message: 'An internal server error occurred',
+ })
+ );
+ }
+);
+
+export default idleUsersHandler;
diff --git a/__mocks__/handlers/members.handler.js b/__mocks__/handlers/members.handler.js
deleted file mode 100644
index 9dcd406ad..000000000
--- a/__mocks__/handlers/members.handler.js
+++ /dev/null
@@ -1,67 +0,0 @@
-import { rest } from 'msw';
-const URL = process.env.NEXT_PUBLIC_BASE_URL;
-
-const membersHandlers = [
- rest.get(`${URL}/members/idle`, (_, res, ctx) => {
- return res(
- ctx.status(200),
- ctx.json({
- message: 'Idle members returned successfully!',
- idleMemberUserNames: [
- 'rohan-rajgupta',
- 'sumit',
- 'swaraj',
- 'rohit',
- 'tanya',
- 'akshay',
- 'shubham',
- 'devashish',
- 'lakshay',
- 'rucha',
- 'swebert',
- 'nikhil',
- 'ishika',
- 'rajakvk',
- 'moses',
- 'prem',
- 'bhavesh',
- 'ankush',
- 'prakash',
- 'deipayan',
- 'mehul',
- 'ashwini',
- 'amanA',
- 'sagar',
- 'shankar',
- 'aman-saxena',
- 'harshith',
- 'pranav',
- 'ankur',
- 'pujarini',
- 'sanyogita',
- 'pavan',
- 'ankita',
- 'shashwat',
- 'vividh',
- 'rahil',
- ],
- })
- );
- }),
-];
-
-export const failedIdleMembersHandler = rest.get(
- `${URL}/members/idle`,
- (_, res, ctx) => {
- return res(
- ctx.status(500),
- ctx.json({
- statusCode: 500,
- error: 'Internal Server Error',
- message: 'An internal server error occurred',
- })
- );
- }
-);
-
-export default membersHandlers;
diff --git a/__tests__/Unit/Components/Tasks/TaskDependency.test.tsx b/__tests__/Unit/Components/Tasks/TaskDependency.test.tsx
index d63e7228d..a1a300776 100644
--- a/__tests__/Unit/Components/Tasks/TaskDependency.test.tsx
+++ b/__tests__/Unit/Components/Tasks/TaskDependency.test.tsx
@@ -43,8 +43,7 @@ describe('TaskDependency', () => {
isEditing={true}
setEditedTaskDetails={setEditedTaskDetails}
/>
- ,
- { query: { dev: 'true' } }
+
);
const checkboxes = container.querySelectorAll('input[type="checkbox"]');
const firstCheckbox = checkboxes[0] as HTMLInputElement;
@@ -68,8 +67,7 @@ describe('TaskDependency', () => {
isEditing={true}
setEditedTaskDetails={setEditedTaskDetails}
/>
- ,
- { query: { dev: 'true' } }
+
);
const loadingText = await waitFor(() => getByText('Loading...'));
expect(loadingText).toBeInTheDocument();
diff --git a/__tests__/Unit/hooks/membersApi.test.tsx b/__tests__/Unit/hooks/idleUsersApi.test.tsx
similarity index 83%
rename from __tests__/Unit/hooks/membersApi.test.tsx
rename to __tests__/Unit/hooks/idleUsersApi.test.tsx
index e8a50320d..f588f8402 100644
--- a/__tests__/Unit/hooks/membersApi.test.tsx
+++ b/__tests__/Unit/hooks/idleUsersApi.test.tsx
@@ -1,13 +1,13 @@
import { setupServer } from 'msw/node';
import handlers, {
- failedIdleMembersHandler,
-} from '../../../__mocks__/handlers/members.handler.js';
+ failedIdleUsersHandler,
+} from '../../../__mocks__/handlers/idle-users.handler.js';
import { PropsWithChildren } from 'react';
import { act, renderHook } from '@testing-library/react-hooks';
import { Provider } from 'react-redux';
import { store } from '@/app/store';
-import { useGetIdleMembersQuery } from '@/app/services/membersApi';
+import { useGetIdleUsersQuery } from '@/app/services/idleUsersApi';
const server = setupServer(...handlers);
@@ -23,10 +23,10 @@ function Wrapper({
return {children};
}
-describe('useGetIdleMembersQuery', () => {
- test('returns idle members', async () => {
+describe('useGetIdleUsersQuery', () => {
+ test('returns idle users', async () => {
const { result, waitForNextUpdate } = renderHook(
- () => useGetIdleMembersQuery(),
+ () => useGetIdleUsersQuery(),
{
wrapper: Wrapper,
}
@@ -46,9 +46,9 @@ describe('useGetIdleMembersQuery', () => {
});
test('checks for error response', async () => {
- server.use(failedIdleMembersHandler);
+ server.use(failedIdleUsersHandler);
const { result, waitForNextUpdate } = renderHook(
- () => useGetIdleMembersQuery(),
+ () => useGetIdleUsersQuery(),
{
wrapper: Wrapper,
}
diff --git a/src/app/services/api.ts b/src/app/services/api.ts
index 5105d0d66..661812310 100644
--- a/src/app/services/api.ts
+++ b/src/app/services/api.ts
@@ -23,7 +23,7 @@ export const api = createApi({
'Tags',
'Levels',
'Challenges',
- 'Idle_Members',
+ 'Idle_Users',
'Progress_Details',
'User_Standup',
'TASK_REQUEST',
diff --git a/src/app/services/idleUsersApi.ts b/src/app/services/idleUsersApi.ts
new file mode 100644
index 000000000..4feb61f26
--- /dev/null
+++ b/src/app/services/idleUsersApi.ts
@@ -0,0 +1,20 @@
+import { USERS_IDLE } from '@/constants/url';
+import { api } from './api';
+import { UserResponseData } from '@/types/AvailabilityPanel';
+type IdleUsersResponse = { users: UserResponseData[] };
+
+export const idleUsersApi = api.injectEndpoints({
+ endpoints: (build) => ({
+ getIdleUsers: build.query({
+ query: () => USERS_IDLE,
+ providesTags: ['Idle_Users'],
+ transformResponse: (response: IdleUsersResponse) => {
+ const IdleUsers = response.users.map((user) => user.username);
+ IdleUsers.sort();
+ return IdleUsers;
+ },
+ }),
+ }),
+});
+
+export const { useGetIdleUsersQuery } = idleUsersApi;
diff --git a/src/app/services/membersApi.ts b/src/app/services/membersApi.ts
deleted file mode 100644
index 594c2610d..000000000
--- a/src/app/services/membersApi.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { MEMBERS_IDLE } from '@/constants/url';
-import { api } from './api';
-
-type IdleMembersResponse = { idleMemberUserNames: string[] };
-export const membersApi = api.injectEndpoints({
- endpoints: (build) => ({
- getIdleMembers: build.query({
- query: () => MEMBERS_IDLE,
- providesTags: ['Idle_Members'],
- transformResponse: (response: IdleMembersResponse) => {
- const filterMembers = response.idleMemberUserNames.filter(
- (username: string) => username
- );
- const sortedIdleMembers = filterMembers.sort();
-
- return sortedIdleMembers;
- },
- }),
- }),
-});
-
-export const { useGetIdleMembersQuery } = membersApi;
diff --git a/src/components/issues/TaskRequestForm.tsx b/src/components/issues/TaskRequestForm.tsx
index 4e585ddc6..55bfd3f81 100644
--- a/src/components/issues/TaskRequestForm.tsx
+++ b/src/components/issues/TaskRequestForm.tsx
@@ -23,7 +23,7 @@ date.setDate(date.getDate() + 7);
const sevenDaysFromToday = date.toISOString().split('T')[0];
const initialState = {
- endsOn: date.getTime(),
+ endsOn: Date.now(),
startedOn: Date.now(),
description: ' ',
};
diff --git a/src/components/taskDetails/index.tsx b/src/components/taskDetails/index.tsx
index 5fa61b001..f795aeb7a 100755
--- a/src/components/taskDetails/index.tsx
+++ b/src/components/taskDetails/index.tsx
@@ -264,24 +264,20 @@ const TaskDetails: FC = ({ taskID }) => {
- {isDevModeEnabled && (
- <>
-
-
-
- >
- )}
+ <>
+
+
+
+ >
diff --git a/src/constants/url.ts b/src/constants/url.ts
index 816b11124..20eee5947 100644
--- a/src/constants/url.ts
+++ b/src/constants/url.ts
@@ -11,7 +11,7 @@ export const LOGIN_URL = `https://github.com/login/oauth/authorize?client_id=23c
export const MEMBERS_URL = 'https://members.realdevsquad.com';
export const CHALLENGES_URL = `${BASE_URL}/challenges`;
export const USER_SELF = `${BASE_URL}/users/self`;
-export const MEMBERS_IDLE = `${BASE_URL}/members/idle`;
+export const USERS_IDLE = `${BASE_URL}/users/search?state=IDLE`;
export const DEFAULT_AVATAR = '/Avatar.png';
export const RDS_LOGO = '/RDSLogo.png';
export const GITHUB_LOGO = '/github-white.png';
diff --git a/src/pages/availability-panel/index.tsx b/src/pages/availability-panel/index.tsx
index 580f94583..037fcb257 100644
--- a/src/pages/availability-panel/index.tsx
+++ b/src/pages/availability-panel/index.tsx
@@ -9,7 +9,7 @@ import updateTasksStatus from '@/helperFunctions/updateTasksStatus';
import { AVAILABLE } from '@/constants/task-status';
import { FEATURE } from '@/constants/task-type';
import { BASE_URL } from '@/constants/url';
-import { useGetIdleMembersQuery } from '@/app/services/membersApi';
+import { useGetIdleUsersQuery } from '@/app/services/idleUsersApi';
const AvailabilityPanel: FC = () => {
const [unAssignedTasks, setUnAssignedTasks] = useState([]);
@@ -21,7 +21,7 @@ const AvailabilityPanel: FC = () => {
isError: isIdleMembersError,
isLoading: isIdleMemberLoading,
refetch: refreshMemberList,
- } = useGetIdleMembersQuery();
+ } = useGetIdleUsersQuery();
useEffect(() => {
const fetchTasks = async () => {
diff --git a/src/types/AvailabilityPanel.d.ts b/src/types/AvailabilityPanel.d.ts
new file mode 100644
index 000000000..0abeb8a04
--- /dev/null
+++ b/src/types/AvailabilityPanel.d.ts
@@ -0,0 +1,30 @@
+export interface UserResponseData {
+ id: string;
+ incompleteUserDetails: boolean;
+ website: string;
+ discordJoinedAt: string;
+ discordId: string;
+ roles: {
+ archived: boolean;
+ in_discord: boolean;
+ member: boolean;
+ };
+ last_name: string;
+ linkedin_id: string;
+ yoe: number;
+ picture: {
+ publicId: string;
+ url: string;
+ };
+ github_created_at: number;
+ github_display_name: string;
+ github_id: string;
+ company: string;
+ designation: string;
+ twitter_id: string;
+ first_name: string;
+ status: string;
+ username: string;
+ updated_at: number;
+ created_at: number;
+}