Skip to content

Commit 02f06c5

Browse files
author
abrar2030
committed
Implement updates for better performance
1 parent d78d9b6 commit 02f06c5

6 files changed

Lines changed: 48 additions & 70 deletions

File tree

backend/accounting-service/src/invoice.controller.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ class InvoiceController {
5151

5252
// Check if user owns the invoice
5353
if (invoice.userId !== userId) {
54-
res
55-
.status(403)
56-
.json({
57-
message: "Forbidden: You do not have access to this invoice",
58-
});
54+
res.status(403).json({
55+
message: "Forbidden: You do not have access to this invoice",
56+
});
5957
return;
6058
}
6159

@@ -104,11 +102,9 @@ class InvoiceController {
104102

105103
// Check if user owns the invoice
106104
if (invoice.userId !== userId) {
107-
res
108-
.status(403)
109-
.json({
110-
message: "Forbidden: You do not have access to this invoice",
111-
});
105+
res.status(403).json({
106+
message: "Forbidden: You do not have access to this invoice",
107+
});
112108
return;
113109
}
114110

@@ -149,11 +145,9 @@ class InvoiceController {
149145

150146
// Check if user owns the invoice
151147
if (invoice.userId !== userId) {
152-
res
153-
.status(403)
154-
.json({
155-
message: "Forbidden: You do not have access to this invoice",
156-
});
148+
res.status(403).json({
149+
message: "Forbidden: You do not have access to this invoice",
150+
});
157151
return;
158152
}
159153

backend/accounting-service/src/transaction.controller.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,9 @@ class TransactionController {
5454

5555
// Check if user owns the transaction
5656
if (transaction.userId !== userId) {
57-
res
58-
.status(403)
59-
.json({
60-
message: "Forbidden: You do not have access to this transaction",
61-
});
57+
res.status(403).json({
58+
message: "Forbidden: You do not have access to this transaction",
59+
});
6260
return;
6361
}
6462

@@ -107,11 +105,9 @@ class TransactionController {
107105

108106
// Check if user owns the transaction
109107
if (transaction.userId !== userId) {
110-
res
111-
.status(403)
112-
.json({
113-
message: "Forbidden: You do not have access to this transaction",
114-
});
108+
res.status(403).json({
109+
message: "Forbidden: You do not have access to this transaction",
110+
});
115111
return;
116112
}
117113

@@ -155,11 +151,9 @@ class TransactionController {
155151

156152
// Check if user owns the transaction
157153
if (transaction.userId !== userId) {
158-
res
159-
.status(403)
160-
.json({
161-
message: "Forbidden: You do not have access to this transaction",
162-
});
154+
res.status(403).json({
155+
message: "Forbidden: You do not have access to this transaction",
156+
});
163157
return;
164158
}
165159

backend/payments-service/src/payment.controller.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,9 @@ class PaymentController {
190190
paymentOwner: payment.userId,
191191
requestId,
192192
});
193-
res
194-
.status(403)
195-
.json({
196-
message: "Forbidden: You do not have access to this payment",
197-
});
193+
res.status(403).json({
194+
message: "Forbidden: You do not have access to this payment",
195+
});
198196
return;
199197
}
200198

@@ -311,11 +309,9 @@ class PaymentController {
311309
paymentOwner: payment.userId,
312310
requestId,
313311
});
314-
res
315-
.status(403)
316-
.json({
317-
message: "Forbidden: You do not have access to this payment",
318-
});
312+
res.status(403).json({
313+
message: "Forbidden: You do not have access to this payment",
314+
});
319315
return;
320316
}
321317

e2e/accounting.spec.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@ test.describe("Accounting and Reporting Flow", () => {
1515

1616
test.beforeEach(async ({ page }) => {
1717
// Use saved authentication state
18-
await page
19-
.context()
20-
.addCookies([
21-
{
22-
name: "accessToken",
23-
value: "mock_access_token",
24-
domain: "localhost",
25-
path: "/",
26-
},
27-
]);
18+
await page.context().addCookies([
19+
{
20+
name: "accessToken",
21+
value: "mock_access_token",
22+
domain: "localhost",
23+
path: "/",
24+
},
25+
]);
2826
await page.goto("http://localhost:3000/accounting");
2927
});
3028

e2e/dashboard.spec.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@ test.describe("Dashboard Functionality", () => {
1515

1616
test.beforeEach(async ({ page }) => {
1717
// Use saved authentication state
18-
await page
19-
.context()
20-
.addCookies([
21-
{
22-
name: "accessToken",
23-
value: "mock_access_token",
24-
domain: "localhost",
25-
path: "/",
26-
},
27-
]);
18+
await page.context().addCookies([
19+
{
20+
name: "accessToken",
21+
value: "mock_access_token",
22+
domain: "localhost",
23+
path: "/",
24+
},
25+
]);
2826
await page.goto("http://localhost:3000/dashboard");
2927
});
3028

e2e/payment.spec.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@ test.describe("Payment Processing Flow", () => {
1515

1616
test.beforeEach(async ({ page }) => {
1717
// Use saved authentication state
18-
await page
19-
.context()
20-
.addCookies([
21-
{
22-
name: "accessToken",
23-
value: "mock_access_token",
24-
domain: "localhost",
25-
path: "/",
26-
},
27-
]);
18+
await page.context().addCookies([
19+
{
20+
name: "accessToken",
21+
value: "mock_access_token",
22+
domain: "localhost",
23+
path: "/",
24+
},
25+
]);
2826
await page.goto("http://localhost:3000/payments");
2927
});
3028

0 commit comments

Comments
 (0)