mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-08-15 00:10:44 +02:00
fix: allow user to basic access conference information
This commit is contained in:
@@ -79,6 +79,30 @@ export default class Conference {
|
|||||||
return this._data.status;
|
return this._data.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get conferenceID() {
|
||||||
|
return this._data.conferenceID;
|
||||||
|
}
|
||||||
|
|
||||||
|
get name() {
|
||||||
|
return this._data.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
get startDate() {
|
||||||
|
return this._data.startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
get endDate() {
|
||||||
|
return this._data.endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
get url() {
|
||||||
|
return this._data.url;
|
||||||
|
}
|
||||||
|
|
||||||
|
get options() {
|
||||||
|
return this._data.options;
|
||||||
|
}
|
||||||
|
|
||||||
toJSON(opt?: { billing: boolean }): any {
|
toJSON(opt?: { billing: boolean }): any {
|
||||||
const pricePerHourPerRepo = this._data.plan.pricePerRepository / 30;
|
const pricePerHourPerRepo = this._data.plan.pricePerRepository / 30;
|
||||||
let price = 0;
|
let price = 0;
|
||||||
|
|||||||
@@ -215,20 +215,31 @@ router.get(
|
|||||||
"/:conferenceID",
|
"/:conferenceID",
|
||||||
async (req: express.Request, res: express.Response) => {
|
async (req: express.Request, res: express.Response) => {
|
||||||
try {
|
try {
|
||||||
const user = await getUser(req);
|
|
||||||
const data = await ConferenceModel.findOne({
|
const data = await ConferenceModel.findOne({
|
||||||
conferenceID: req.params.conferenceID,
|
conferenceID: req.params.conferenceID,
|
||||||
});
|
});
|
||||||
if (!data)
|
if (!data)
|
||||||
throw new AnonymousError("conf_not_found", {
|
throw new AnonymousError("conf_not_found", {
|
||||||
object: req.params.conferenceID,
|
object: req.params.conferenceID,
|
||||||
httpStatus: 404,
|
httpStatus: 404,
|
||||||
});
|
});
|
||||||
|
const user = await getUser(req);
|
||||||
const conference = new Conference(data);
|
const conference = new Conference(data);
|
||||||
isOwnerOrAdmin(conference.ownerIDs, user);
|
try {
|
||||||
const o: any = conference.toJSON();
|
isOwnerOrAdmin(conference.ownerIDs, user);
|
||||||
o.repositories = (await conference.repositories()).map((r) => r.toJSON());
|
const o: any = conference.toJSON();
|
||||||
res.json(o);
|
o.repositories = (await conference.repositories()).map((r) => r.toJSON());
|
||||||
|
res.json(o);
|
||||||
|
} catch (error) {
|
||||||
|
return res.json({
|
||||||
|
conferenceID: conference.conferenceID,
|
||||||
|
name: conference.name,
|
||||||
|
url: conference.url,
|
||||||
|
startDate: conference.startDate,
|
||||||
|
endDate: conference.endDate,
|
||||||
|
options: conference.options,
|
||||||
|
})
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error, res);
|
handleError(error, res);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user