implementiran share by link
This commit is contained in:
@@ -132,7 +132,10 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:nu
|
||||
return(locations)
|
||||
})
|
||||
|
||||
export const fetchLocationById = withUser(async (user:AuthenticatedUser, locationID:string) => {
|
||||
/*
|
||||
ova metoda je zamijenjena sa jednostavnijom `fetchLocationById`, koja brže radi jer ne provjerava korisnika
|
||||
|
||||
export const fetchLocationByUserAndId = withUser(async (user:AuthenticatedUser, locationID:string) => {
|
||||
|
||||
noStore();
|
||||
|
||||
@@ -158,7 +161,34 @@ export const fetchLocationById = withUser(async (user:AuthenticatedUser, locatio
|
||||
}
|
||||
|
||||
return(billLocation);
|
||||
})
|
||||
});
|
||||
*/
|
||||
|
||||
export const fetchLocationById = async (locationID:string) => {
|
||||
|
||||
noStore();
|
||||
|
||||
const dbClient = await getDbClient();
|
||||
|
||||
// find a location with the given locationID
|
||||
const billLocation = await dbClient.collection<BillingLocation>("lokacije")
|
||||
.findOne(
|
||||
{ _id: locationID },
|
||||
{
|
||||
projection: {
|
||||
// don't include the attachment binary data in the response
|
||||
"bills.attachment.fileContentsBase64": 0,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if(!billLocation) {
|
||||
console.log(`Location ${locationID} not found`);
|
||||
return(null);
|
||||
}
|
||||
|
||||
return(billLocation);
|
||||
};
|
||||
|
||||
export const deleteLocationById = withUser(async (user:AuthenticatedUser, locationID:string, yearMonth:YearMonth) => {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user