generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
148 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<string[], void>({ | ||
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; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |