-
Notifications
You must be signed in to change notification settings - Fork 0
Roko/fly talks be #533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Roko/fly talks be #533
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
faf76fb
Fetch fly talks groups
rokoperki 9780795
Merge remote-tracking branch 'origin/main' into roko/fly-talks-be
rokoperki 013b400
Apply to flytalks
rokoperki d5c3278
Connected images to wallets
rokoperki e141c33
Merge remote-tracking branch 'origin/main' into roko/fly-talks-be
rokoperki 1452e65
minor changes
rokoperki 9d6bcc0
added user guards
rokoperki 5a2e9c9
added filter in fly talks fetch
rokoperki e327583
Merge branch 'main' into roko/fly-talks-be
ToniGrbic db97be6
removed extra user guard
lovretomic ed3dcb4
fixes
lovretomic 50ec871
avoided window reloading
lovretomic 897a538
renamed functions and routes
lovretomic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { BlobService } from 'src/blob/blob.service'; | ||
import { PrismaService } from 'src/prisma.service'; | ||
|
||
import { EventController } from './event.controller'; | ||
import { EventService } from './event.service'; | ||
|
||
@Module({ | ||
controllers: [EventController], | ||
providers: [EventService, PrismaService], | ||
providers: [EventService, PrismaService, BlobService], | ||
}) | ||
export class EventModule {} |
This file contains hidden or 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 hidden or 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,32 @@ | ||
import { useMutation, useQueryClient } from 'react-query'; | ||
import axios from '../base'; | ||
import toast from 'react-hot-toast'; | ||
import { QUERY_KEYS } from '@/constants/queryKeys'; | ||
|
||
const deleteFlyTalkApplication = async ({ | ||
eventId, | ||
}: { | ||
eventId: number; | ||
}): Promise<{ eventId: number }> => { | ||
return axios.delete('/event/delete-flytalk-application', { | ||
data: { eventId }, | ||
}); | ||
}; | ||
|
||
export const useDeleteFlyTalkApplication = () => { | ||
const queryClient = useQueryClient(); | ||
return useMutation(deleteFlyTalkApplication, { | ||
onSuccess: () => { | ||
queryClient.refetchQueries([QUERY_KEYS.flyTalkGroups]); | ||
toast.success('Termin je uspješno odjavljen.'); | ||
}, | ||
onError: (error: import('axios').AxiosError<{ message?: string }>) => { | ||
console.error('Došlo je do greške: ', error); | ||
const errorMessage = | ||
error?.response?.data?.message || | ||
error?.message || | ||
'Došlo je do greške.'; | ||
toast.error(errorMessage); | ||
}, | ||
}); | ||
}; |
This file contains hidden or 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,15 @@ | ||
import axios from '../base'; | ||
import { useQuery } from 'react-query'; | ||
import { QUERY_KEYS } from '@/constants/queryKeys'; | ||
import { EventWithCompanyDto } from '@ddays-app/types'; | ||
|
||
const getAllFlyTalkGroups = async (): Promise<EventWithCompanyDto[]> => { | ||
return axios.get('/event/fly-talks-with-company'); | ||
}; | ||
|
||
export const useGetAllFlyTalkGroups = () => { | ||
return useQuery<EventWithCompanyDto[]>( | ||
[QUERY_KEYS.flyTalkGroups], | ||
getAllFlyTalkGroups, | ||
); | ||
}; |
This file contains hidden or 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,28 @@ | ||
import { QUERY_KEYS } from "@/constants/queryKeys"; | ||
import { UserToEventDto } from "@ddays-app/types"; | ||
import axios from "../base"; | ||
import toast from "react-hot-toast"; | ||
import { useMutation, QueryClient } from "react-query"; | ||
|
||
const queryClient = new QueryClient(); | ||
|
||
|
||
const postApplyToFlyTalks = async (data: UserToEventDto): Promise<UserToEventDto> => { | ||
return axios.post<UserToEventDto, UserToEventDto>('/event/apply-to-flytalk', data); | ||
} | ||
|
||
export const usePostApplyToFlyTalks = () => { | ||
return useMutation( | ||
postApplyToFlyTalks, { | ||
onSuccess: () => { | ||
queryClient.invalidateQueries([QUERY_KEYS.applyFlyTalk]); | ||
}, | ||
onError: (error: import("axios").AxiosError<{ message?: string }>) => { | ||
console.error("Error applying to FlyTalk:", error); | ||
const errorMessage = error?.response?.data?.message || error?.message || "An unexpected error occurred."; | ||
toast.error(errorMessage); | ||
}, | ||
} | ||
|
||
); | ||
}; |
This file contains hidden or 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,23 @@ | ||
import { useMutation } from 'react-query'; | ||
import axios from '../base'; | ||
import toast from 'react-hot-toast'; | ||
|
||
const uploadCV = async (file: File): Promise<string> => { | ||
const formData = new FormData(); | ||
formData.append('file', file); | ||
|
||
return await axios.post('event/upload-cv', formData, { | ||
headers: { | ||
'Content-Type': 'multipart/form-data', | ||
}, | ||
responseType: 'text', | ||
}); | ||
}; | ||
|
||
export const useUploadCV = () => { | ||
return useMutation((file: File) => uploadCV(file), { | ||
onError: () => { | ||
toast.error('Greška prilikom slanja CV-a'); | ||
}, | ||
}); | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jel bi tribalo zaštitt rute koje nemaj nikakav Guard, ili User ili Admin pa provjeri.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doda san na skoro sve sta user koristi userGuard