Merge branch 'hotfix/1.33.1' into develop
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
|
// fetch all locations for the given year
|
||||||
const locations = await dbClient.collection<BillingLocation>("lokacije")
|
const locations = await dbClient.collection<BillingLocation>("lokacije")
|
||||||
.find(
|
.aggregate([
|
||||||
{
|
{
|
||||||
|
$match: {
|
||||||
userId,
|
userId,
|
||||||
"yearMonth.year": year,
|
"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,
|
"_id": 1,
|
||||||
// "userId": 0,
|
// "userId": 0,
|
||||||
// "userEmail": 0,
|
// "userEmail": 0,
|
||||||
@@ -130,17 +149,20 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:nu
|
|||||||
"bills.name": 1,
|
"bills.name": 1,
|
||||||
"bills.paid": 1,
|
"bills.paid": 1,
|
||||||
"bills.payedAmount": 1,
|
"bills.payedAmount": 1,
|
||||||
|
"bills.hasAttachment": 1,
|
||||||
// "bills.attachment": 0,
|
// "bills.attachment": 0,
|
||||||
// "bills.notes": 0,
|
// "bills.notes": 0,
|
||||||
// "bills.barcodeImage": 1,
|
// "bills.barcodeImage": 1,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
{
|
||||||
.sort({
|
$sort: {
|
||||||
"yearMonth.year": -1,
|
"yearMonth.year": -1,
|
||||||
"yearMonth.month": -1,
|
"yearMonth.month": -1,
|
||||||
name: 1,
|
name: 1,
|
||||||
})
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
.toArray();
|
.toArray();
|
||||||
|
|
||||||
return(locations)
|
return(locations)
|
||||||
|
|||||||
@@ -42,6 +42,11 @@ export interface Bill {
|
|||||||
payedAmount?: number | null;
|
payedAmount?: number | null;
|
||||||
/** attached document (optional) */
|
/** attached document (optional) */
|
||||||
attachment?: BillAttachment|null;
|
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 */
|
/** (optional) notes */
|
||||||
notes?: string|null;
|
notes?: string|null;
|
||||||
/** (optional) image data containing PDF471 bar code */
|
/** (optional) image data containing PDF471 bar code */
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export interface BillBadgeProps {
|
|||||||
bill: Bill
|
bill: Bill
|
||||||
};
|
};
|
||||||
|
|
||||||
export const BillBadge:FC<BillBadgeProps> = ({ locationId, bill: { _id: billId, name, paid, attachment }}) =>
|
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 && !!attachment ? "btn-outline btn-success" : "" } cursor-pointer`}>
|
<Link href={`/bill/${locationId}-${billId}/edit`} className={`badge badge-lg ${paid?"badge-success":" badge-outline"} ${ !paid && hasAttachment ? "btn-outline btn-success" : "" } cursor-pointer`}>
|
||||||
{name}
|
{name}
|
||||||
</Link>;
|
</Link>;
|
||||||
@@ -4,7 +4,7 @@ version: "3.7"
|
|||||||
networks:
|
networks:
|
||||||
traefik-network:
|
traefik-network:
|
||||||
name: "traefik-network"
|
name: "traefik-network"
|
||||||
attachable: true # omogućuje da se mreža može koristiti i iz drugih stackova
|
external: true
|
||||||
mongo-network:
|
mongo-network:
|
||||||
name: "mongo-network"
|
name: "mongo-network"
|
||||||
attachable: false
|
attachable: false
|
||||||
@@ -13,7 +13,7 @@ networks:
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
web-app:
|
web-app:
|
||||||
image: utility-bills-tracker:1.32.0
|
image: utility-bills-tracker:1.33.1
|
||||||
networks:
|
networks:
|
||||||
- traefik-network
|
- traefik-network
|
||||||
- mongo-network
|
- mongo-network
|
||||||
@@ -71,30 +71,3 @@ services:
|
|||||||
- traefik.http.services.mongo-express.loadbalancer.server.port=8081
|
- traefik.http.services.mongo-express.loadbalancer.server.port=8081
|
||||||
- traefik.http.routers.mongo-express.entrypoints=http
|
- traefik.http.routers.mongo-express.entrypoints=http
|
||||||
- traefik.http.routers.mongo-express.rule=Host(`mongo.rezije.app`)
|
- traefik.http.routers.mongo-express.rule=Host(`mongo.rezije.app`)
|
||||||
|
|
||||||
reverse-proxy:
|
|
||||||
image: traefik:v2.3
|
|
||||||
command:
|
|
||||||
# Traefik web konzoli se pristupa preko HTTP, a ne HTTPS
|
|
||||||
- --api.insecure=true
|
|
||||||
- --providers.docker
|
|
||||||
# activates the Swarm Mode (instead of standalone Docker).
|
|
||||||
# - kada je `false` neće detektirati containere kada se pokrene sa `docker-compose up`
|
|
||||||
- --providers.docker.swarmMode=true
|
|
||||||
# prikazuj samo containere koji su nakačeni na Traefik
|
|
||||||
- --providers.docker.exposedByDefault=false
|
|
||||||
# "ping" omogućujemo za potrebe healthcheck-a
|
|
||||||
- --ping=true
|
|
||||||
- --ping.entryPoint=traefik
|
|
||||||
#- --accesslog=true
|
|
||||||
#- --log.level=DEBUG
|
|
||||||
- --entryPoints.http.address=:3000
|
|
||||||
ports:
|
|
||||||
- "3001:3000"
|
|
||||||
- "8080:8080"
|
|
||||||
volumes:
|
|
||||||
# So that Traefik can listen to the Docker events
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
networks:
|
|
||||||
- traefik-network
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user