Skip to content

Commit

Permalink
doc(dev): 📝 Remove local mongod explainations
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 2a08dbdb786c8144ce2980aa540e7006e0c98590
  • Loading branch information
p-bizouard committed Mar 4, 2024
1 parent 1b6fab0 commit 5912110
Show file tree
Hide file tree
Showing 23 changed files with 130 additions and 301 deletions.
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ It is used in production at French engineering school CentraleSupélec and enabl

[Watch the 1-minute demo >>](https://vimeo.com/250163250)

![The booking pop-up](https://github.com/oxlay/Resa/blob/master/images-for-readme/booking-popup.png)
![The booking pop-up](docs/assets/booking-popup.png)

## General structure

Expand All @@ -33,7 +33,7 @@ Advanced features:
- see all the events planned for a room on a particular day
- use direct link to book a particular room: `resa.example.com/recherche/{roomId}` (especially useful if you put QR codes outside of rooms that can be booked)

![The room list](https://github.com/oxlay/Resa/blob/master/images-for-readme/room-list.png)
![The room list](docs/assets/room-list.png)

## Built with

Expand All @@ -44,13 +44,25 @@ Advanced features:

As well as many other projects you can find in `front/package.json` and `back/package.json`.

## Authors
## Contributors

**Lead developer:** Anatole Beuzon
### Initial version

**Lead developer:** [Anatole Beuzon](https://github.com/anatolebeuzon)

**Project manager:** Michel Guennoc

**Contributors and reviewers:** Ronan Pelliard and Sami Tabet
**Contributors and reviewers:** [Ronan Pelliard](https://github.com/rpelliard) and [Sami Tabet](https://github.com/sfluor)

### Since first release

- [Benjamin Koltes](https://github.com/Ayc0)
- [Guillaume Denis](https://github.com/silently)
- [Teo Lefebvre](https://github.com/TeoLefebvre)
- [Marius Verdier](https://github.com/marius-verdier)
- [Thomas Houdin](https://github.com/gamma3591)
- [Louis Vauterin](https://github.com/Louis-Vauterin)
- [Antoine Fonlupt](https://github.com/Antoine-Fonlupt)

## License

Expand Down
42 changes: 7 additions & 35 deletions back/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,10 @@ git clone
cd back
```

### Mongo
### Database

With a global installation:

- [Install mongo globally](https://docs.mongodb.com/manual/installation/)
- Start mongo service: run `mongod`
- Connect to mongo service: run `mongo`

Alternatively, using docker:

- Install docker and run it (for instance through the Docker Desktop app, or through the `dockerd` command)
- Start mongo service: `docker run --rm -p 27017:27017 -d -v ~/data:/data/db --name mongodb mongo`
- Connect to mongo service: `docker run -it --link mongodb:mongo --rm mongo mongo --host mongo`

Alternatively, using docker-compose:

- Start docker containers `docker-compose up -d`
- Connect to mongo service with mongosh `docker-compose exec -it mongodb mongosh`
- Start docker containers `docker compose up -d`
- Connect to mongo service with mongosh `docker compose exec -it mongodb mongosh`

Then create the user `resa` on the database, this is the express application user:

Expand Down Expand Up @@ -98,8 +84,8 @@ Create `src/config/secrets.json`:
"tokenSecret": "<random string to generate random strings for token>"
},
"smtp": {
"host": "<smtp-url>",
"port": "<smtp-port>"
"host": "localhost",
"port": "1025"
},
"adminEmail": "<admin-mail>",
"ccEmail": "<cc-mail>",
Expand Down Expand Up @@ -134,22 +120,8 @@ And replace <resa-base-url> in your secrets.json by >`http://localhost.<domain-y

Ensure the mongo service is running:

- if installed globally:

```console
$ mongod
```

- if using docker:

```console
$ yarn mongo-docker-start
```

- if using docker-compose:

```console
$ docker-compose up -d
$ docker compose up -d
```

Launch the app (see port default setting in `bin/www` file):
Expand All @@ -163,7 +135,7 @@ $ yarn dev
Connect to the mongo shell:

```console
$ yarn mongo-docker-shell
$ docker compose exec -it mongodb mongosh
```

## Docker setup
Expand Down
4 changes: 2 additions & 2 deletions back/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"test": "yarn run lint && yarn flow stop && yarn flow",
"lint": "eslint --ext .js src",
"lint-fix": "eslint --ext .js --fix src",
"mongo-docker-start": "docker stop mongodb;docker run --rm -p 27017:27017 -d -v ~/data:/data/db --name mongodb mongo",
"mongo-docker-shell": "docker run -it --link mongodb:mongo --rm mongo mongo --host mongo",
"mongo-docker-start": "docker compose up -d",
"mongo-docker-shell": "docker compose exec -it mongodb mongosh",
"prettier": "git diff — name-only HEAD | xargs prettier - write \"{,!(node_modules)/**/}*.js\""
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion back/src/routes/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ router.post("/add/", requireAgendaAnnuaire, async (
/!\ startDate and endDate must be in ISO 8601 string format.
*/

try {
// Sanity check of inputs
validate.input(validate.schema.addEvent, req.body);
Expand All @@ -60,7 +61,7 @@ router.post("/add/", requireAgendaAnnuaire, async (
);
if (!room.allowBookings) {
if (room.belongsTo.length === 0) {
logger.error("Room need to belongs to a group that has some members");
// ? Room need to belongs to a group that has some members
res.sendStatus(500);
return;
}
Expand Down
7 changes: 4 additions & 3 deletions back/src/webservice/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,10 @@ async function getStapledPersonEventList(
.filter((event) => event.room !== null) // Filter out events about rooms that don't exist anymore in GEODE
.filter((event) => event.endDate.isAfter(moment().subtract(3, "months"))); // Filter out past bookings older than 3 months old

parsedEvents.sort(
(eventA, eventB) => eventA.startDate.valueOf() - eventB.startDate.valueOf(),
);
parsedEvents.sort(
(eventA, eventB) => eventA.startDate.valueOf() - eventB.startDate.valueOf(),
);


// Group past and future events separately
const groupedParsedEvents /* : { [key: "future" | "past" ]: Event_Room[] } */ = groupBy(
Expand Down
Binary file added docs/assets/booking-popup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/room-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

[_Resa_](https://resa.centralesupelec.fr/) est conçue pour faciliter l'accès aux espaces de travail et de réunion sur le campus universitaire. Que vous soyez étudiant, enseignant, personnel administratif ou membre de la communauté universitaire, notre service vous permet de réserver facilement des salles adaptées à vos besoins.

![The booking pop-up](assets/booking-popup.png)

## Caractéristiques principales

- **Réservation simplifiée** : Notre interface vous permet de trouver et de réserver une salle en quelques clics. Vous pouvez consulter les disponibilités, les capacités d'accueil et les équipements disponibles associés à chaque salle.
Expand Down
57 changes: 15 additions & 42 deletions front/src/actions/bookings/modify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,18 @@ import {
RECEIVE_MODIF_ALREADY_BOOKED_ERROR,
} from './types';

export const initializeModifModal = makeActionCreator(
INITIALIZE_MODIF_MODAL,
'event',
'modifType',
);
export const setNameOfModifiedEvent = makeActionCreator(
SET_NAME_OF_MODIFIED_EVENT,
'newName',
);
export const setStartHourOfModifiedEvent = makeActionCreator(
SET_START_HOUR_OF_MODIFIED_EVENT,
'newStartHour',
);
export const setStartMinutesOfModifiedEvent = makeActionCreator(
SET_START_MINUTES_OF_MODIFIED_EVENT,
'newStartMinutes',
);
export const setEndHourOfModifiedEvent = makeActionCreator(
SET_END_HOUR_OF_MODIFIED_EVENT,
'newEndHour',
);
export const setEndMinutesOfModifiedEvent = makeActionCreator(
SET_END_MINUTES_OF_MODIFIED_EVENT,
'newEndMinutes',
);
export const setRoomIdOfModifiedEvent = makeActionCreator(
SET_ROOM_ID_OF_MODIFIED_EVENT,
'newRoomId',
);
export const initializeModifModal = makeActionCreator(INITIALIZE_MODIF_MODAL, 'event', 'modifType');
export const setNameOfModifiedEvent = makeActionCreator(SET_NAME_OF_MODIFIED_EVENT, 'newName');
export const setStartHourOfModifiedEvent = makeActionCreator(SET_START_HOUR_OF_MODIFIED_EVENT, 'newStartHour');
export const setStartMinutesOfModifiedEvent = makeActionCreator(SET_START_MINUTES_OF_MODIFIED_EVENT, 'newStartMinutes');
export const setEndHourOfModifiedEvent = makeActionCreator(SET_END_HOUR_OF_MODIFIED_EVENT, 'newEndHour');
export const setEndMinutesOfModifiedEvent = makeActionCreator(SET_END_MINUTES_OF_MODIFIED_EVENT, 'newEndMinutes');
export const setRoomIdOfModifiedEvent = makeActionCreator(SET_ROOM_ID_OF_MODIFIED_EVENT, 'newRoomId');
export const attemptModifConfirm = makeActionCreator(ATTEMPT_MODIF_CONFIRM);
export const requestModif = makeActionCreator(REQUEST_MODIF);
export const receiveModifConfirmation = makeActionCreator(
RECEIVE_MODIF_CONFIRMATION,
);
export const receiveModifUnknownError = makeActionCreator(
RECEIVE_MODIF_UNKNOWN_ERROR,
);
export const receiveModifAlreadyBookedError = makeActionCreator(
RECEIVE_MODIF_ALREADY_BOOKED_ERROR,
);
export const receiveModifConfirmation = makeActionCreator(RECEIVE_MODIF_CONFIRMATION);
export const receiveModifUnknownError = makeActionCreator(RECEIVE_MODIF_UNKNOWN_ERROR);
export const receiveModifAlreadyBookedError = makeActionCreator(RECEIVE_MODIF_ALREADY_BOOKED_ERROR);

export function sendModifRequest(event, newAttr) {
function getUpdatedISOstring(isoDate, hour, minutes) {
Expand All @@ -71,6 +43,7 @@ export function sendModifRequest(event, newAttr) {

// Do nothing if eventName is empty
if (!newAttr.eventName) return;

dispatch(requestModif());

// Format dates
Expand All @@ -87,10 +60,10 @@ export function sendModifRequest(event, newAttr) {

// Test if something has changed
if (
event.name === newAttr.eventName &&
event.startDate === newStartDate &&
event.endDate === newEndDate &&
event.room.id === newAttr.roomId
event.name === newAttr.eventName
&& event.startDate === newStartDate
&& event.endDate === newEndDate
&& event.room.id === newAttr.roomId
) {
dispatch(receiveModifConfirmation());
return;
Expand Down
13 changes: 7 additions & 6 deletions front/src/actions/rooms/book/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { forceFetchBookings } from 'actions/bookings/list';
import {
SELECT_ROOM_TO_BOOK,
SET_EVENT_NAME,
SET_FOR_USER_NAME,
SET_VIDEO_PROVIDER,
ATTEMPT_BOOK_CONFIRM,
REQUEST_BOOK,
Expand All @@ -23,7 +22,6 @@ export const selectRoomToBook = makeActionCreator(
'payload',
);
export const setEventName = makeActionCreator(SET_EVENT_NAME, 'payload');
export const setForUserName = makeActionCreator(SET_FOR_USER_NAME, 'payload');
export const setVideoProvider = makeActionCreator(
SET_VIDEO_PROVIDER,
'payload',
Expand Down Expand Up @@ -52,9 +50,12 @@ export function sendBookRequest() {
dispatch(attemptBookConfirm());

const state = getState();
const { room, eventName, forUserName, videoProvider } = state.search.book;
const { selectedDate, selectedStartTime, selectedEndTime } =
state.search.dateTime;
const { room, eventName, videoProvider } = state.search.book;
const {
selectedDate,
selectedStartTime,
selectedEndTime,
} = state.search.dateTime;
const formattedDate = getFormattedDate(
selectedDate,
selectedStartTime,
Expand All @@ -74,7 +75,7 @@ export function sendBookRequest() {
'Content-Type': 'application/json',
},
body: JSON.stringify({
eventName: forUserName ? `${forUserName} - ${eventName}` : eventName,
eventName,
videoProvider,
startDate: formattedDate.start,
endDate: formattedDate.end,
Expand Down
1 change: 0 additions & 1 deletion front/src/actions/rooms/book/types.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export const SELECT_ROOM_TO_BOOK = 'SELECT_ROOM_TO_BOOK';
export const SET_EVENT_NAME = 'SET_EVENT_NAME';
export const SET_FOR_USER_NAME = 'SET_FOR_USER_NAME';
export const SET_VIDEO_PROVIDER = 'SET_VIDEO_PROVIDER';
export const ATTEMPT_BOOK_CONFIRM = 'ATTEMPT_BOOK_CONFIRM';
export const REQUEST_BOOK = 'REQUEST_BOOK';
Expand Down
17 changes: 12 additions & 5 deletions front/src/components/partials/EventList.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const EventList = ({
Aucun évènement n&apos;est prévu
{!useToday && ` le ${moment(selectedDate).format('D MMMM')} `}
{useToday && " aujourd'hui "}
en &nbsp;
en
&nbsp;
<span className="font-weight-bold">{roomName}</span>
</h6>
);
Expand All @@ -36,7 +37,8 @@ const EventList = ({
{events.length >= 2 && `${events.length} évènements sont prévus`}
{!useToday && ` le ${moment(selectedDate).format('D MMMM')} `}
{useToday && " aujourd'hui "}
en &nbsp;
en
&nbsp;
<span className="font-weight-bold">{roomName}</span>
</h6>
<div className="list-group mt-3">
Expand All @@ -53,13 +55,18 @@ const EventList = ({
<h5 className="mb-1">{event.name}</h5>
<span className={!isHighlighted ? 'text-muted' : ''}>
de&nbsp;
{moment(event.startDate).utc().format('H[h]mm')}
{moment(event.startDate)
.utc()
.format('H[h]mm')}
&nbsp;à&nbsp;
{moment(event.endDate).utc().format('H[h]mm')}
{moment(event.endDate)
.utc()
.format('H[h]mm')}
</span>
</div>
<span className={!isHighlighted ? 'text-muted' : ''}>
Réservé par &nbsp;
Réservé par
&nbsp;
<a
className={!isHighlighted ? 'text-secondary' : 'text-white'}
href={`mailto:${event.author.email}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import 'moment/locale/fr';
import RoomResource from 'containers/partials/RoomResource';
import extractResources from 'services/extractResources';

const Booking = ({ event, handleCancelEvent, handleModifyEvent, isFuture }) => (
const Booking = ({
event, handleCancelEvent, handleModifyEvent, isFuture,
}) => (
<div className="card mb-3">
<div className="card-body">
<div className="row align-items-center justify-content-between">
Expand All @@ -21,8 +23,8 @@ const Booking = ({ event, handleCancelEvent, handleModifyEvent, isFuture }) => (
</div>
<div className="col-lg-4">
<ul>
{event.room &&
extractResources(event.room, true).map((res) => (
{event.room
&& extractResources(event.room, true).map((res) => (
<RoomResource
key={`${event.room.id}#${res.type}`}
resource={res}
Expand All @@ -33,13 +35,19 @@ const Booking = ({ event, handleCancelEvent, handleModifyEvent, isFuture }) => (
</div>
<div className="col-lg-3 my-4 custom-info-text-color">
<h5>{event.name}</h5>
{moment(event.startDate).utc().format('dddd D MMMM YYYY')}
{moment(event.startDate)
.utc()
.format('dddd D MMMM YYYY')}
<br />
{moment(event.startDate).utc().format('H[h]mm')}
{moment(event.startDate)
.utc()
.format('H[h]mm')}
&nbsp;
<FontAwesomeIcon icon={faAngleRight} />
&nbsp;
{moment(event.endDate).utc().format('H[h]mm')}
{moment(event.endDate)
.utc()
.format('H[h]mm')}
</div>
<div className="col-lg-3 custom-text-right-above-lg custom-text-center-under-lg">
{isFuture && !event.local && (
Expand Down
Loading

0 comments on commit 5912110

Please sign in to comment.