Compare commits
No commits in common. "1a7bc9c73c9ae101d2cba9ff83b88762a2305a6d" and "65101384e212bab39b8b897bacd4a7bf0468198d" have entirely different histories.
1a7bc9c73c
...
65101384e2
5 changed files with 13 additions and 29 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,7 +9,6 @@ bin
|
||||||
database.txt
|
database.txt
|
||||||
plantuml.jar
|
plantuml.jar
|
||||||
db.sqlite3
|
db.sqlite3
|
||||||
db.sqlite3-journal
|
|
||||||
diagram.puml
|
diagram.puml
|
||||||
backend/*.png
|
backend/*.png
|
||||||
backend/*.jpg
|
backend/*.jpg
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CREATE TABLE IF NOT EXISTS weekly_reports (
|
CREATE TABLE IF NOT EXISTS weekly_reports (
|
||||||
report_id INTEGER AUTO_INCREMENT UNIQUE,
|
report_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
user_id INTEGER NOT NULL,
|
user_id INTEGER NOT NULL,
|
||||||
project_id INTEGER NOT NULL,
|
project_id INTEGER NOT NULL,
|
||||||
week INTEGER NOT NULL,
|
week INTEGER NOT NULL,
|
||||||
|
@ -12,6 +12,5 @@ CREATE TABLE IF NOT EXISTS weekly_reports (
|
||||||
signed_by INTEGER,
|
signed_by INTEGER,
|
||||||
FOREIGN KEY (user_id) REFERENCES users(id),
|
FOREIGN KEY (user_id) REFERENCES users(id),
|
||||||
FOREIGN KEY (project_id) REFERENCES projects(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,18 +33,3 @@ VALUES (3,3,"member");
|
||||||
|
|
||||||
INSERT OR IGNORE INTO user_roles(user_id,project_id,p_role)
|
INSERT OR IGNORE INTO user_roles(user_id,project_id,p_role)
|
||||||
VALUES (2,1,"project_manager");
|
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,12 +87,14 @@ interface API {
|
||||||
): Promise<APIResponse<NewWeeklyReport>>;
|
): Promise<APIResponse<NewWeeklyReport>>;
|
||||||
|
|
||||||
/** Gets a weekly report for a specific user, project and week
|
/** 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} projectName The name of the project.
|
||||||
* @param {string} week The week number.
|
* @param {string} week The week number.
|
||||||
* @param {string} token The authentication token.
|
* @param {string} token The authentication token.
|
||||||
* @returns {Promise<APIResponse<WeeklyReport>>} A promise resolving to an API response with the retrieved report.
|
* @returns {Promise<APIResponse<WeeklyReport>>} A promise resolving to an API response with the retrieved report.
|
||||||
*/
|
*/
|
||||||
getWeeklyReport(
|
getWeeklyReport(
|
||||||
|
username: string,
|
||||||
projectName: string,
|
projectName: string,
|
||||||
week: string,
|
week: string,
|
||||||
token: string,
|
token: string,
|
||||||
|
@ -317,21 +319,20 @@ export const api: API = {
|
||||||
},
|
},
|
||||||
|
|
||||||
async getWeeklyReport(
|
async getWeeklyReport(
|
||||||
|
username: string,
|
||||||
projectName: string,
|
projectName: string,
|
||||||
week: string,
|
week: string,
|
||||||
token: string,
|
token: string,
|
||||||
): Promise<APIResponse<WeeklyReport>> {
|
): Promise<APIResponse<WeeklyReport>> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch("/api/getWeeklyReport", {
|
||||||
`/api/getWeeklyReport?projectName=${projectName}&week=${week}`,
|
method: "GET",
|
||||||
{
|
headers: {
|
||||||
method: "GET",
|
"Content-Type": "application/json",
|
||||||
headers: {
|
Authorization: "Bearer " + token,
|
||||||
"Content-Type": "application/json",
|
|
||||||
Authorization: "Bearer " + token,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
);
|
body: JSON.stringify({ username, projectName, week }),
|
||||||
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
return { success: false, message: "Failed to get weekly report" };
|
return { success: false, message: "Failed to get weekly report" };
|
||||||
|
|
|
@ -16,8 +16,8 @@ function AllTimeReportsInProject(): JSX.Element {
|
||||||
const getWeeklyReports = async (): Promise<void> => {
|
const getWeeklyReports = async (): Promise<void> => {
|
||||||
const token = localStorage.getItem("accessToken") ?? "";
|
const token = localStorage.getItem("accessToken") ?? "";
|
||||||
const response = await api.getWeeklyReportsForUser(
|
const response = await api.getWeeklyReportsForUser(
|
||||||
projectName ?? "",
|
|
||||||
token,
|
token,
|
||||||
|
projectName ?? "",
|
||||||
);
|
);
|
||||||
console.log(response);
|
console.log(response);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
|
|
Loading…
Reference in a new issue