Skip to content

Commit

Permalink
feat: add user email in events dataset. Uses must have at least one d…
Browse files Browse the repository at this point in the history
…ataset
  • Loading branch information
nicolas-bonnel committed May 13, 2024
1 parent 8571976 commit 6855147
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions contract/use.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module.exports = {
title: 'Jeu de données',
additionalProperties: false,
required: ['id'],
minItems: 1,
properties: {
href: { type: 'string' },
title: { type: 'string' },
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,17 @@ services:
image: ghcr.io/data-fair/elasticsearch:7.17.1
ports:
- 9200:9200
- 9300:9300
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- ingest.geoip.downloader.enabled=false
- ES_JAVA_OPTS=-Xms2g -Xmx2g
healthcheck:
test: ["CMD", "nc", "-z", "-v", "localhost", "9200"]
start_period: 10s
interval: 5s
retries: 5

mongo:
profiles:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Portals manager for data-fair",
"main": "index.js",
"scripts": {
"dev-server": "NODE_ENV=development DEBUG=upgrade* nodemon server",
"dev-server": "NODE_ENV=development DEBUG=sync-portal,upgrade* nodemon server",
"dev-client": "NODE_ENV=development nuxt -p 3039",
"dev-built": "NODE_ENV=development npm run build && rm -rf nuxt-dist-standalone && cp -rf nuxt-dist nuxt-dist-standalone && PROXY_NUXT=false npm run dev-server",
"dev-deps": "docker-compose --profile dev up -d",
Expand Down
2 changes: 1 addition & 1 deletion public/components/events/register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default {
if (event === null) await this.$axios.$delete(`${this.eventsDatasetUrl}/own/user:${this.user.id}/lines/${this.lineId}`)
else await this.$axios.$patch(`${this.eventsDatasetUrl}/own/user:${this.user.id}/lines/${this.lineId}`, { register: event })
} else {
if (event !== null) await this.$axios.$post(`${this.eventsDatasetUrl}/own/user:${this.user.id}/lines`, { pageId: this.pageId, pageTitle: this.pageTitle, register: event })
if (event !== null) await this.$axios.$post(`${this.eventsDatasetUrl}/own/user:${this.user.id}/lines`, { pageId: this.pageId, pageTitle: this.pageTitle, register: event, email: this.user.email })
}
eventBus.$emit('notification', { type: 'success', msg: 'Votre choix a bien été enregistré' })
} catch (error) {
Expand Down
4 changes: 3 additions & 1 deletion server/router/portals.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ async function syncPortalUpdate (portal, cookie) {
{ params: { key: config.secretKeys.sites } }
)
}

debugSyncPortal(`sync images dataset ${id}`)
debugSyncPortal(imagesDatasetUtils.init(portal))
await axios.put(
`${config.dataFairUrl}/api/v1/datasets/${imagesDatasetUtils.id(portal)}`,
imagesDatasetUtils.init(portal),
Expand All @@ -148,6 +148,7 @@ async function syncPortalUpdate (portal, cookie) {
{ headers: { cookie } }
)
}
debugSyncPortal(`sync events dataset ${id}`)
if (portal.config && (portal.config.showEvents || (portal.config.eventsPage && portal.config.eventsPage.type !== 'none'))) {
await axios.put(
`${config.dataFairUrl}/api/v1/datasets/${eventsDatasetUtils.id(portal)}`,
Expand Down Expand Up @@ -499,6 +500,7 @@ router.patch('/:id/pages/:pageId', asyncWrap(setPortalAdmin(true)), asyncWrap(as
// Restrict the parts of the page that can be edited by API

const acceptedParts = Object.keys(pageSchema.properties).filter(k => !pageSchema.properties[k].readOnly)
acceptedParts.push('config')
const adminOnlyParts = ['published', 'publishedAt', 'public', 'navigation'] // copied in pages edit.vue

for (const key in req.body) {
Expand Down
14 changes: 14 additions & 0 deletions server/utils/events-dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ exports.init = (portal) => {
maxLength: 200,
description: ''
},
{
key: 'email',
type: 'string',
title: 'Email',
icon: 'mdi-text-short',
'x-capabilities': {
textAgg: false,
text: false,
insensitive: false,
textStandard: false
},
maxLength: 100,
description: ''
},
{
key: 'register',
type: 'boolean',
Expand Down

0 comments on commit 6855147

Please sign in to comment.