Skip to content

Commit

Permalink
aggiunti grants a seminar, colloquium e conference
Browse files Browse the repository at this point in the history
  • Loading branch information
aziis98 committed Oct 5, 2023
1 parent bf7e188 commit ebda58c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions server/models/Event.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const {
notes,
} = require('./Model')

const Grant = require('./Grant')

//
// Seminario
//
Expand Down Expand Up @@ -37,6 +39,7 @@ const eventSeminarSchema = new Schema({
'seminari-map'
],
},
grants: [{type: ObjectId, label: 'grants', ref: 'Grant'}],
abstract: { type: String, label: 'Abstract', widget: 'text' },

createdBy,
Expand All @@ -47,6 +50,14 @@ const eventSeminarSchema = new Schema({

const EventSeminar = model('EventSeminar', eventSeminarSchema)

Grant.relatedModels.push({
model: EventSeminar,
modelName: 'EventSeminar',
url: 'event-seminar',
field: 'grants',
multiple: true,
})

//
// Conferenza
//
Expand All @@ -58,6 +69,7 @@ const eventConferenceSchema = new Schema({
SSD,
url: { type: String, label: 'Sito web' },
conferenceRoom: { type: ObjectId, label: 'Stanza', ref: 'ConferenceRoom', required: true },
grants: [{type: ObjectId, label: 'grants', ref: 'Grant'}],
notes,

createdBy,
Expand All @@ -68,6 +80,14 @@ const eventConferenceSchema = new Schema({

const EventConference = model('EventConference', eventConferenceSchema)

Grant.relatedModels.push({
model: EventConference,
modelName: 'EventConference',
url: 'event-conference',
field: 'grants',
multiple: true,
})

//
// Colloquium
//
Expand All @@ -78,6 +98,7 @@ const eventColloquiumSchema = new Schema({
conferenceRoom: { type: ObjectId, label: 'Stanza', ref: 'ConferenceRoom', required: true },
startDate,
duration: { type: Number, label: 'Durata (in minuti)', default: 120 },
grants: [{type: ObjectId, label: 'grants', ref: 'Grant'}],
notes,

createdBy,
Expand All @@ -88,6 +109,14 @@ const eventColloquiumSchema = new Schema({

const EventColloquium = model('EventColloquium', eventColloquiumSchema)

Grant.relatedModels.push({
model: EventColloquium,
modelName: 'EventColloquium',
url: 'event-colloquium',
field: 'grants',
multiple: true,
})

//
// Corso di Dottorato
//
Expand Down
2 changes: 1 addition & 1 deletion src/components/RelatedDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function RelatedDetails({ Model, related, title }) {
case 'Person':
return <a href={`/${info.url}/${obj._id}`}>{obj.lastName} {obj.firstName}</a>
default:
return <span>not implemented {JSON.stringify(info)}</span>
return <a href={`/${info.url}/${obj._id}`}>{engine.Models[info.modelName].describe(obj)}</a>
}
}).map((_,i) => <li key={i}>{_} </li>)}
</ul>
Expand Down

0 comments on commit ebda58c

Please sign in to comment.