Compare commits
16 commits
65101384e2
...
1a7bc9c73c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1a7bc9c73c | ||
![]() |
b00ce7a0ed | ||
![]() |
ec138163c6 | ||
![]() |
a51d984229 | ||
![]() |
70cf40feb5 | ||
![]() |
0dc7e3bf99 | ||
![]() |
4288b064f3 | ||
![]() |
49ca043157 | ||
![]() |
69d07624ce | ||
![]() |
a9e515925e | ||
![]() |
91c9f50491 | ||
![]() |
e8c660705f | ||
![]() |
be3adb09ae | ||
![]() |
8fbb4be0ad | ||
![]() |
eff14516b4 | ||
![]() |
7b78767f50 |
5 changed files with 29 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,6 +9,7 @@ bin
|
|||
database.txt
|
||||
plantuml.jar
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
diagram.puml
|
||||
backend/*.png
|
||||
backend/*.jpg
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CREATE TABLE IF NOT EXISTS weekly_reports (
|
||||
report_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
report_id INTEGER AUTO_INCREMENT UNIQUE,
|
||||
user_id INTEGER NOT NULL,
|
||||
project_id INTEGER NOT NULL,
|
||||
week INTEGER NOT NULL,
|
||||
|
@ -12,5 +12,6 @@ CREATE TABLE IF NOT EXISTS weekly_reports (
|
|||
signed_by INTEGER,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id),
|
||||
FOREIGN KEY (project_id) REFERENCES projects(id),
|
||||
FOREIGN KEY (signed_by) REFERENCES users(id)
|
||||
FOREIGN KEY (signed_by) REFERENCES users(id),
|
||||
PRIMARY KEY (user_id, project_id, week)
|
||||
);
|
|
@ -33,3 +33,18 @@ VALUES (3,3,"member");
|
|||
|
||||
INSERT OR IGNORE INTO user_roles(user_id,project_id,p_role)
|
||||
VALUES (2,1,"project_manager");
|
||||
|
||||
INSERT OR IGNORE INTO weekly_reports (user_id, project_id, week, development_time, meeting_time, admin_time, own_work_time, study_time, testing_time, signed_by)
|
||||
VALUES (2, 1, 12, 20, 10, 5, 30, 15, 10, NULL);
|
||||
|
||||
INSERT OR IGNORE INTO weekly_reports (user_id, project_id, week, development_time, meeting_time, admin_time, own_work_time, study_time, testing_time, signed_by)
|
||||
VALUES (3, 1, 12, 20, 10, 5, 30, 15, 10, NULL);
|
||||
|
||||
INSERT OR IGNORE INTO weekly_reports (user_id, project_id, week, development_time, meeting_time, admin_time, own_work_time, study_time, testing_time, signed_by)
|
||||
VALUES (3, 1, 14, 20, 10, 5, 30, 15, 10, NULL);
|
||||
|
||||
INSERT OR IGNORE INTO weekly_reports (user_id, project_id, week, development_time, meeting_time, admin_time, own_work_time, study_time, testing_time, signed_by)
|
||||
VALUES (3, 2, 12, 20, 10, 5, 30, 15, 10, NULL);
|
||||
|
||||
INSERT OR IGNORE INTO weekly_reports (user_id, project_id, week, development_time, meeting_time, admin_time, own_work_time, study_time, testing_time, signed_by)
|
||||
VALUES (3, 3, 12, 20, 10, 5, 30, 15, 10, NULL);
|
||||
|
|
|
@ -87,14 +87,12 @@ interface API {
|
|||
): Promise<APIResponse<NewWeeklyReport>>;
|
||||
|
||||
/** Gets a weekly report for a specific user, project and week
|
||||
* @param {string} username The username of the user.
|
||||
* @param {string} projectName The name of the project.
|
||||
* @param {string} week The week number.
|
||||
* @param {string} token The authentication token.
|
||||
* @returns {Promise<APIResponse<WeeklyReport>>} A promise resolving to an API response with the retrieved report.
|
||||
*/
|
||||
getWeeklyReport(
|
||||
username: string,
|
||||
projectName: string,
|
||||
week: string,
|
||||
token: string,
|
||||
|
@ -319,20 +317,21 @@ export const api: API = {
|
|||
},
|
||||
|
||||
async getWeeklyReport(
|
||||
username: string,
|
||||
projectName: string,
|
||||
week: string,
|
||||
token: string,
|
||||
): Promise<APIResponse<WeeklyReport>> {
|
||||
try {
|
||||
const response = await fetch("/api/getWeeklyReport", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: "Bearer " + token,
|
||||
const response = await fetch(
|
||||
`/api/getWeeklyReport?projectName=${projectName}&week=${week}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: "Bearer " + token,
|
||||
},
|
||||
},
|
||||
body: JSON.stringify({ username, projectName, week }),
|
||||
});
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
return { success: false, message: "Failed to get weekly report" };
|
||||
|
|
|
@ -16,8 +16,8 @@ function AllTimeReportsInProject(): JSX.Element {
|
|||
const getWeeklyReports = async (): Promise<void> => {
|
||||
const token = localStorage.getItem("accessToken") ?? "";
|
||||
const response = await api.getWeeklyReportsForUser(
|
||||
token,
|
||||
projectName ?? "",
|
||||
token,
|
||||
);
|
||||
console.log(response);
|
||||
if (response.success) {
|
||||
|
|
Loading…
Reference in a new issue