13. Events
Description
Events are used in the Calendar view of the Crowdex application. They serve to represent various types of activities related to a specific project or the entire platform. There are two types of events: meetings and polls. Meetings can be either public, meaning any user can view or participate in them, or internal, meaning they are assigned to a specific project. Polls, on the other hand, can only be internal. Users can participate in internal events of a project only if they have invested in it. In the case of a poll, a user can cast only one vote, which cannot be changed afterwards.
Prerequisites
How to create Internal Meeting Event in strapi admin?
- Choose INTERNAL_MEETING as type
- Add Related Crowdex Project entity (Required)
- Choose and fill
Meeting
inAdd a component to typeData

How to create Public Meeting Event in strapi admin?
- Choose PUBLIC_MEETING as type
- Add Related Crowdex Project entity (Optional)
- Choose and fill
Meeting
inAdd a component to typeData

How to create Poll Event in strapi admin?
- Choose POLL as type
- Add Related Crowdex Project entity (Required)
- Choose and fill
Poll
inAdd a component to typeData

GRAPHQL
1. The groupedEvents query returns events categorized as future events, current events, and past events. It also returns the projects in which the user has invested.
query GroupedEventsQuery($projectId: String) {
groupedEvents(projectId: $projectId) {
userInvestedProjects {
data {
id
attributes {
title
}
}
}
currentEvents {
data {
id
attributes {
closeDate
openDate
title
type
typeData {
... on ComponentDefaultMeeting {
nameResponsiblePerson
emailResponsiblePerson
phoneResponsiblePerson
nameProxyPerson
emailProxyPerson
phoneProxyPerson
place
}
... on ComponentDefaultPoll {
pollOptions {
id
value
}
}
}
description
documents {
data {
id
attributes {
url
name
}
}
}
}
}
}
pastEvents {
data {
id
attributes {
closeDate
openDate
title
type
typeData {
... on ComponentDefaultMeeting {
nameResponsiblePerson
emailResponsiblePerson
phoneResponsiblePerson
nameProxyPerson
emailProxyPerson
phoneProxyPerson
place
}
... on ComponentDefaultPoll {
pollOptions {
id
value
}
}
}
description
documents {
data {
id
attributes {
url
name
}
}
}
}
}
}
futureEvents {
data {
id
attributes {
closeDate
openDate
title
type
typeData {
... on ComponentDefaultMeeting {
nameResponsiblePerson
emailResponsiblePerson
phoneResponsiblePerson
nameProxyPerson
emailProxyPerson
phoneProxyPerson
place
}
... on ComponentDefaultPoll {
pollOptions {
id
value
}
}
}
description
documents {
data {
id
attributes {
url
name
}
}
}
}
}
}
}
}
Authorization: Bearer ACCESS_TOKEN
Responses:
{
"data": {
"groupedEvents": {
"userInvestedProjects": {
"data": [
{
"id": "5",
"attributes": {
"title": "Project1"
}
},
{
"id": "6",
"attributes": {
"title": "Project2"
}
}
]
},
"currentEvents": {
"data": []
},
"pastEvents": {
"data": [
{
"id": "4",
"attributes": {
"closeDate": "2024-07-13T22:00:00.000Z",
"openDate": "2024-06-30T22:00:00.000Z",
"title": "Poll in the past",
"type": "POLL",
"typeData": [
{
"pollOptions": [
{
"id": "4",
"value": "aaa"
},
{
"id": "5",
"value": "qqqaaq"
},
{
"id": "6",
"value": "asdasdasaadas"
}
]
}
],
"description": "aaaaaaaaa",
"documents": {
"data": []
}
}
},
{
"id": "2",
"attributes": {
"closeDate": "2024-07-21T22:00:00.000Z",
"openDate": "2024-06-30T22:00:00.000Z",
"title": "Meeting Past",
"type": "PUBLIC_MEETING",
"typeData": [
{
"nameResponsiblePerson": "qweqweq",
"emailResponsiblePerson": "qweqw@qweqw",
"phoneResponsiblePerson": "qeqwe",
"nameProxyPerson": "qweqw",
"emailProxyPerson": "qweqw@qweqwe",
"phoneProxyPerson": "qweqwe",
"place": "qweqwe"
}
],
"description": "Great meeting",
"documents": {
"data": []
}
}
},
{
"id": "1",
"attributes": {
"closeDate": "2024-07-22T22:00:00.000Z",
"openDate": "2024-07-21T22:00:00.000Z",
"title": "poll 1",
"type": "POLL",
"typeData": [
{
"pollOptions": [
{
"id": "1",
"value": "qqqqq"
},
{
"id": "2",
"value": "qweqweqw"
},
{
"id": "3",
"value": "qwrqweqwe"
}
]
}
],
"description": "qqweqweqwe",
"documents": {
"data": [
{
"id": "99",
"attributes": {
"url": "/uploads/mnr_Res_Areas_16_07_613316675e.pdf",
"name": "mnrRes Areas_16-07.pdf"
}
}
]
}
}
}
]
},
"futureEvents": {
"data": [
{
"id": "5",
"attributes": {
"closeDate": "2024-08-27T22:00:00.000Z",
"openDate": "2024-07-30T22:00:00.000Z",
"title": "Poll future",
"type": "POLL",
"typeData": [
{
"pollOptions": [
{
"id": "7",
"value": "qweqwe"
},
{
"id": "8",
"value": "qweqweqw"
}
]
}
],
"description": "qweqweqwe",
"documents": {
"data": [
{
"id": "45",
"attributes": {
"url": "/uploads/BN_81_22836_A_03_WEB_G75_NB_G85_NB_EU_POL_221004_0_bd98e82a64.pdf",
"name": "BN81-22836A-03_WEB_G75NB G85NB_EU_POL_221004.0.pdf"
}
}
]
}
}
}
]
}
}
}
}
When calling with the ID of a project that the user has not invested in:
{
"errors": [
{
"message": "NOT_INVESTED_IN_PROJECT",
"extensions": {
"error": {
"name": "ApplicationError",
"message": "NOT_INVESTED_IN_PROJECT",
"details": {}
},
"code": "STRAPI_APPLICATION_ERROR"
}
}
],
"data": null
}
2. pollStatistics query returns statistics for specific event of type POLL.
query PollStatisticsQuery($eventId: String!) {
pollStatistics(eventId: $eventId) {
totalVotes
userVote
pollOptionDataList {
percentageOfTotalVotes
pollOption {
id
value
}
}
}
}
Authorization: Bearer ACCESS_TOKEN
userVote - id of PollOption that current user has chosen. If user has not voted yet, it will be null.
If the user has not voted yet, other fields will also be returned as null.
Responses:
When the user has already voted:
{
"data": {
"pollStatistics": {
"totalVotes": "3",
"userVote": "1",
"pollOptionDataList": [
{
"percentageOfTotalVotes": "66.67",
"pollOption": {
"id": "1",
"value": "Option 1"
}
},
{
"percentageOfTotalVotes": "33.33",
"pollOption": {
"id": "2",
"value": "Option 2"
}
},
{
"percentageOfTotalVotes": "0.00",
"pollOption": {
"id": "3",
"value": "Option 3"
}
}
]
}
}
}
Before the user has voted:
{
"data": {
"pollStatistics": {
"totalVotes": null,
"userVote": null,
"pollOptionDataList": null
}
}
}
Authorization: Bearer ACCESS_TOKEN
3. registerVote mutation - Used to register a vote for the chosen poll option from the selected event.
mutation RegisterVoteMutation($pollOptionId: String!, $eventId: String!) {
registerVote(pollOptionId: $pollOptionId, eventId: $eventId) {
status
}
}
Response:
{
"data": {
"registerVote": {
"status": "OK"
}
}
}