Skip to content

Commit

Permalink
Merge branch 'release/1.9.0' into prod
Browse files Browse the repository at this point in the history
  • Loading branch information
estellecomment committed Jan 26, 2021
2 parents 851c8db + 83f1b23 commit bbe4d01
Show file tree
Hide file tree
Showing 10 changed files with 238 additions and 161 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,27 @@ On utilise également cet appel dans la page de status, pour vérifier que la co

- Obtenir l'historique d'une conf passée donnée : `GET /telephony/${process.env.OVH_ACCOUNT_NUMBER}/conference/${phoneNumber}/histories/${callId}`

## Mise en prod
La mise en prod est faite à la main pour le moment.

Procédé basique :
- On fait une branche release:
```
git checkout main
git pull
git checkout -B release/X.Y.Z
```
- On incrémente le numéro de version dans package.json et on commit dans la branche de release. On teste cette branche de release.
- on merge la release dans la branche `prod`
```
git checkout prod
git merge --no-ff release/X.Y.Z
```
- on fait une release sur github (https://github.com/betagouv/audioconf/releases/new) en décrivant les modifications apportées par cette release. Ce process crée un tag sur le commit de la release.
- on déploie la branche prod sur Scalingo.
- on merge `prod` dans `main` (pour récupérer le numéro de version et les éventuelles modifs de test):
```
git checkout main
git pull
git merge --no-ff prod
```
8 changes: 1 addition & 7 deletions controllers/createConfController.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const createConfWithDay = async (email, conferenceDay, userTimezoneOffset) => {

const OVHconfData = await conferences.createConf(freeAt)

const conference = await db.insertConferenceWithFreeAt(email, OVHconfData.phoneNumber, OVHconfData.freeAt)
const conference = await db.insertConferenceWithDay(email, OVHconfData.phoneNumber, conferenceDay, OVHconfData.freeAt)
conference.pin = OVHconfData.pin
return conference
} catch (err) {
Expand Down Expand Up @@ -101,12 +101,6 @@ module.exports.showConf = async (req, res) => {
return res.redirect('/')
}

// Whether this conf was booked for the whole day.
conference.isDayConference = false
if (!conference.durationInMinutes) {
conference.isDayConference = true
}

res.render('confCreated', {
pageTitle: 'Votre conférence',
conference
Expand Down
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ if (config.NODE_ENV === "development") {
console.dir({ config })
}

const version = require("./package.json").version

const app = express()

app.set("view engine", "ejs")
Expand Down Expand Up @@ -57,6 +59,7 @@ app.use(function(req, res, next){
res.locals.infos = req.flash("info")
res.locals.successes = req.flash("success")
res.locals.urls = urls
res.locals.version = version
next()
})

Expand Down
10 changes: 9 additions & 1 deletion lib/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports.insertConference = async (email, phoneNumber, durationInMinutes,
}
}

module.exports.insertConferenceWithFreeAt = async (email, phoneNumber, expiresAt) => {
module.exports.insertConferenceWithDay = async (email, phoneNumber, conferenceDay, expiresAt) => {
const domain = parseEmail(email).domain
const hashedEmail = format.hashForLogs(email)

Expand All @@ -49,6 +49,7 @@ module.exports.insertConferenceWithFreeAt = async (email, phoneNumber, expiresAt
expiresAt,
domain,
hashedEmail,
conferenceDay,
})
.returning("*")

Expand All @@ -64,6 +65,13 @@ module.exports.getUnexpiredConference = async (id) => {
const conferences = await knex("conferences").select()
.where({ id: id })
.andWhere("expiresAt", ">", new Date())
// Format the conferenceDays to be YYYY-MM-DD strings, rather than full Date objects
// (the field is a table.date in knex, not a table.datetime, so it's less confusing to use a dateString.)
conferences.forEach(conference => {
if (conference.conferenceDay) {
conference.conferenceDay = format.formatStandardDate(conference.conferenceDay)
}
})
return conferences[0]
} catch (err) {
console.error("getUnexpiredConference: Impossible de récupérer la conférence %s", id, err)
Expand Down
11 changes: 11 additions & 0 deletions migrations/20210122164657_add-conference-day-in-conferences.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exports.up = function (knex) {
return knex.schema.table("conferences", function (table) {
table.date("conferenceDay")
})
}

exports.down = function (knex) {
return knex.schema.table("conferences", function (table) {
table.dropColumn("conferenceDay")
})
}
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "conferences",
"version": "1.8.0",
"version": "1.9.0",
"description": "Conférences audio et vidéo pour les fonctionnaires de l'Etat",
"main": "index.js",
"directories": {
Expand Down
Loading

0 comments on commit bbe4d01

Please sign in to comment.