-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backend support for the campaigns' expenses (#453)
* Add support for expenses report per campain. Allow the user to upload files for each expense. * Allow for expense files to be downloaded and delete by the coordinator of the campaign or by the admin. * Add an API to fetch the approved expenses list from the DB in the campaign page. * Disable some of the expenses unit tests. They seem obsolete, and we don't need blocked amount logic currently. * Review comments mostly: 1. remove can-edit endoint - we can do this in the frontent with the current endpoints. 2. move list expenses to the campaign controller. 3. Fetch the uploader it from the logged user. It used to be hardcoded. * Add security validations when we create expenses. Make sure it is either the organizer or an admin. * Fix a bug in the credentials of the expenses list if the user is an actually admin. ---------
- Loading branch information
Showing
24 changed files
with
452 additions
and
71 deletions.
There are no files selected for viewing
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
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
3 changes: 3 additions & 0 deletions
3
apps/api/src/domain/generated/expenseFile/dto/connect-expenseFile.dto.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,3 @@ | ||
export class ConnectExpenseFileDto { | ||
id: string | ||
} |
4 changes: 4 additions & 0 deletions
4
apps/api/src/domain/generated/expenseFile/dto/create-expenseFile.dto.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,4 @@ | ||
export class CreateExpenseFileDto { | ||
filename: string | ||
mimetype: string | ||
} |
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,3 @@ | ||
export * from './connect-expenseFile.dto' | ||
export * from './create-expenseFile.dto' | ||
export * from './update-expenseFile.dto' |
4 changes: 4 additions & 0 deletions
4
apps/api/src/domain/generated/expenseFile/dto/update-expenseFile.dto.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,4 @@ | ||
export class UpdateExpenseFileDto { | ||
filename?: string | ||
mimetype?: string | ||
} |
12 changes: 12 additions & 0 deletions
12
apps/api/src/domain/generated/expenseFile/entities/expenseFile.entity.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,12 @@ | ||
import { Expense } from '../../expense/entities/expense.entity' | ||
import { Person } from '../../person/entities/person.entity' | ||
|
||
export class ExpenseFile { | ||
id: string | ||
filename: string | ||
mimetype: string | ||
expenseId: string | ||
uploaderId: string | ||
expense?: Expense | ||
uploadedBy?: Person | ||
} |
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 @@ | ||
export * from './expenseFile.entity' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export class CreateExpenseFileDto { | ||
filename: string | ||
mimetype: string | ||
expenseId: string | ||
uploaderId: string | ||
} |
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
Oops, something went wrong.