-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add functionality to assign thesis advisors, reject and accept applic…
…ations
- Loading branch information
1 parent
50dfb3f
commit 6b766f6
Showing
17 changed files
with
787 additions
and
260 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
25 changes: 25 additions & 0 deletions
25
client/src/redux/thesisApplicationsSlice/thunks/acceptThesisApplication.ts
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,25 @@ | ||
import { createAsyncThunk } from '@reduxjs/toolkit' | ||
import axios from 'axios' | ||
import { serverBaseUrl } from '../../../service/configService' | ||
|
||
export const acceptThesisApplication = createAsyncThunk( | ||
'thesisApplications/acceptThesisApplication', | ||
|
||
async (thesisApplicationId: string, { rejectWithValue }) => { | ||
try { | ||
return ( | ||
await axios.post( | ||
`${serverBaseUrl}/api/thesis-applications/${thesisApplicationId}/accept`, | ||
{}, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${localStorage.getItem('jwt_token') ?? ''}`, | ||
}, | ||
}, | ||
) | ||
).data | ||
} catch (err) { | ||
return rejectWithValue(err) | ||
} | ||
}, | ||
) |
31 changes: 31 additions & 0 deletions
31
client/src/redux/thesisApplicationsSlice/thunks/assignThesisAdvisor.ts
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,31 @@ | ||
import { createAsyncThunk } from '@reduxjs/toolkit' | ||
import axios from 'axios' | ||
import { serverBaseUrl } from '../../../service/configService' | ||
|
||
export const assignThesisAdvisor = createAsyncThunk( | ||
'thesisApplications/assignThesisAdvisor', | ||
|
||
async ( | ||
{ | ||
thesisApplicationId, | ||
thesisAdvisorId, | ||
}: { thesisApplicationId: string; thesisAdvisorId: string }, | ||
{ rejectWithValue }, | ||
) => { | ||
try { | ||
return ( | ||
await axios.post( | ||
`${serverBaseUrl}/api/thesis-applications/${thesisApplicationId}/thesis-advisor/${thesisAdvisorId}`, | ||
{}, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${localStorage.getItem('jwt_token') ?? ''}`, | ||
}, | ||
}, | ||
) | ||
).data | ||
} catch (err) { | ||
return rejectWithValue(err) | ||
} | ||
}, | ||
) |
25 changes: 25 additions & 0 deletions
25
client/src/redux/thesisApplicationsSlice/thunks/rejectThesisApplication.ts
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,25 @@ | ||
import { createAsyncThunk } from '@reduxjs/toolkit' | ||
import axios from 'axios' | ||
import { serverBaseUrl } from '../../../service/configService' | ||
|
||
export const rejectThesisApplication = createAsyncThunk( | ||
'thesisApplications/rejectThesisApplication', | ||
|
||
async (thesisApplicationId: string, { rejectWithValue }) => { | ||
try { | ||
return ( | ||
await axios.post( | ||
`${serverBaseUrl}/api/thesis-applications/${thesisApplicationId}/reject`, | ||
{}, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${localStorage.getItem('jwt_token') ?? ''}`, | ||
}, | ||
}, | ||
) | ||
).data | ||
} catch (err) { | ||
return rejectWithValue(err) | ||
} | ||
}, | ||
) |
22 changes: 22 additions & 0 deletions
22
client/src/redux/thesisApplicationsSlice/thunks/updateThesisAdvisorList.ts
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,22 @@ | ||
import { createAsyncThunk } from '@reduxjs/toolkit' | ||
import axios from 'axios' | ||
import { serverBaseUrl } from '../../../service/configService' | ||
import { type ThesisAdvisor } from '../thesisApplicationsSlice' | ||
|
||
export const updateThesisAdvisorList = createAsyncThunk( | ||
'thesisApplications/updateThesisAdvisorList', | ||
|
||
async (thesisAdvisor: ThesisAdvisor, { rejectWithValue }) => { | ||
try { | ||
return ( | ||
await axios.put(`${serverBaseUrl}/api/thesis-applications/thesis-advisors`, thesisAdvisor, { | ||
headers: { | ||
Authorization: `Bearer ${localStorage.getItem('jwt_token') ?? ''}`, | ||
}, | ||
}) | ||
).data | ||
} catch (err) { | ||
return rejectWithValue(err) | ||
} | ||
}, | ||
) |
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
8 changes: 8 additions & 0 deletions
8
server/src/main/java/prompt/ls1/exception/FailedMailSend.java
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,8 @@ | ||
package prompt.ls1.exception; | ||
|
||
public class FailedMailSend extends RuntimeException{ | ||
|
||
public FailedMailSend(String message) { | ||
super(message); | ||
} | ||
} |
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,36 @@ | ||
package prompt.ls1.model; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import jakarta.persistence.UniqueConstraint; | ||
import jakarta.validation.constraints.Email; | ||
import lombok.Data; | ||
import org.hibernate.validator.constraints.Length; | ||
|
||
import java.util.UUID; | ||
|
||
@Data | ||
@Entity | ||
@Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "email" }), | ||
@UniqueConstraint(columnNames = { "tumId" }) }) | ||
public class ThesisAdvisor { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.UUID) | ||
private UUID id; | ||
|
||
private String firstName; | ||
|
||
private String lastName; | ||
|
||
@Column(length = 50) | ||
@Length(max = 50) | ||
private String tumId; | ||
@Column(unique = true) | ||
private String email; | ||
} |
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
Oops, something went wrong.