Compare commits

..

No commits in common. "1a7bc9c73c9ae101d2cba9ff83b88762a2305a6d" and "65101384e212bab39b8b897bacd4a7bf0468198d" have entirely different histories.

5 changed files with 13 additions and 29 deletions

1
.gitignore vendored
View file

@ -9,7 +9,6 @@ bin
database.txt
plantuml.jar
db.sqlite3
db.sqlite3-journal
diagram.puml
backend/*.png
backend/*.jpg

View file

@ -1,5 +1,5 @@
CREATE TABLE IF NOT EXISTS weekly_reports (
report_id INTEGER AUTO_INCREMENT UNIQUE,
report_id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
project_id INTEGER NOT NULL,
week INTEGER NOT NULL,
@ -12,6 +12,5 @@ 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),
PRIMARY KEY (user_id, project_id, week)
FOREIGN KEY (signed_by) REFERENCES users(id)
);

View file

@ -33,18 +33,3 @@ 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);

View file

@ -87,12 +87,14 @@ 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,
@ -317,21 +319,20 @@ export const api: API = {
},
async getWeeklyReport(
username: string,
projectName: string,
week: string,
token: string,
): Promise<APIResponse<WeeklyReport>> {
try {
const response = await fetch(
`/api/getWeeklyReport?projectName=${projectName}&week=${week}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + token,
},
const response = await fetch("/api/getWeeklyReport", {
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" };

View file

@ -16,8 +16,8 @@ function AllTimeReportsInProject(): JSX.Element {
const getWeeklyReports = async (): Promise<void> => {
const token = localStorage.getItem("accessToken") ?? "";
const response = await api.getWeeklyReportsForUser(
projectName ?? "",
token,
projectName ?? "",
);
console.log(response);
if (response.success) {