Merge branch 'hotfix/1.33.1'
This commit is contained in:
@@ -110,13 +110,32 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:nu
|
||||
|
||||
// fetch all locations for the given year
|
||||
const locations = await dbClient.collection<BillingLocation>("lokacije")
|
||||
.find(
|
||||
.aggregate([
|
||||
{
|
||||
userId,
|
||||
"yearMonth.year": year,
|
||||
$match: {
|
||||
userId,
|
||||
"yearMonth.year": year,
|
||||
},
|
||||
},
|
||||
{
|
||||
projection: {
|
||||
$addFields: {
|
||||
bills: {
|
||||
$map: {
|
||||
input: "$bills",
|
||||
as: "bill",
|
||||
in: {
|
||||
_id: "$$bill._id",
|
||||
name: "$$bill.name",
|
||||
paid: "$$bill.paid",
|
||||
payedAmount: "$$bill.payedAmount",
|
||||
hasAttachment: { $ne: ["$$bill.attachment", null] },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: {
|
||||
"_id": 1,
|
||||
// "userId": 0,
|
||||
// "userEmail": 0,
|
||||
@@ -130,17 +149,20 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:nu
|
||||
"bills.name": 1,
|
||||
"bills.paid": 1,
|
||||
"bills.payedAmount": 1,
|
||||
"bills.hasAttachment": 1,
|
||||
// "bills.attachment": 0,
|
||||
// "bills.notes": 0,
|
||||
// "bills.barcodeImage": 1,
|
||||
},
|
||||
}
|
||||
)
|
||||
.sort({
|
||||
"yearMonth.year": -1,
|
||||
"yearMonth.month": -1,
|
||||
name: 1,
|
||||
})
|
||||
},
|
||||
{
|
||||
$sort: {
|
||||
"yearMonth.year": -1,
|
||||
"yearMonth.month": -1,
|
||||
name: 1,
|
||||
},
|
||||
},
|
||||
])
|
||||
.toArray();
|
||||
|
||||
return(locations)
|
||||
|
||||
@@ -42,6 +42,11 @@ export interface Bill {
|
||||
payedAmount?: number | null;
|
||||
/** attached document (optional) */
|
||||
attachment?: BillAttachment|null;
|
||||
/**
|
||||
* true if there an attachment
|
||||
* @description this field enables us to send this info to the client without sending large attachment - it's an optimization
|
||||
*/
|
||||
hasAttachment: boolean;
|
||||
/** (optional) notes */
|
||||
notes?: string|null;
|
||||
/** (optional) image data containing PDF471 bar code */
|
||||
|
||||
@@ -7,7 +7,7 @@ export interface BillBadgeProps {
|
||||
bill: Bill
|
||||
};
|
||||
|
||||
export const BillBadge:FC<BillBadgeProps> = ({ locationId, bill: { _id: billId, name, paid, attachment }}) =>
|
||||
<Link href={`/bill/${locationId}-${billId}/edit`} className={`badge badge-lg ${paid?"badge-success":" badge-outline"} ${ !paid && !!attachment ? "btn-outline btn-success" : "" } cursor-pointer`}>
|
||||
export const BillBadge:FC<BillBadgeProps> = ({ locationId, bill: { _id: billId, name, paid, hasAttachment }}) =>
|
||||
<Link href={`/bill/${locationId}-${billId}/edit`} className={`badge badge-lg ${paid?"badge-success":" badge-outline"} ${ !paid && hasAttachment ? "btn-outline btn-success" : "" } cursor-pointer`}>
|
||||
{name}
|
||||
</Link>;
|
||||
@@ -13,7 +13,7 @@ networks:
|
||||
|
||||
services:
|
||||
web-app:
|
||||
image: utility-bills-tracker:1.32.0
|
||||
image: utility-bills-tracker:1.33.1
|
||||
networks:
|
||||
- traefik-network
|
||||
- mongo-network
|
||||
|
||||
Reference in New Issue
Block a user