Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2695acf
Added compose file for mongodb
Apr 21, 2022
3089a94
rename compose file
Apr 21, 2022
db53bd1
package-lock for node 12
Apr 21, 2022
bc7efd6
use volume for db dump
Apr 21, 2022
37612b7
Datamodel for event timeline and created gql api for updating event
Apr 21, 2022
e699f8a
wip: event form now uses gql -- in somewhat of a broken state
Apr 27, 2022
05e4c3c
wipetiwip
Apr 27, 2022
912afb8
wip yup schema
May 3, 2022
b812078
finished yup schema
May 5, 2022
6f5e045
Fixed event form using GQL
May 7, 2022
f1ac7ae
Fucken fixed
May 7, 2022
5e4e303
Fixed timeline for styling
May 16, 2022
b34ca86
Merge pull request #3 from CadusTech/feature/10-event-form-rework
ronkkol May 16, 2022
7eb6190
Unused import
May 16, 2022
005b000
fix for event form
May 18, 2022
a6c0270
render timeline on dashboard (#4)
ronkkol May 21, 2022
b679d0e
7 - Challenge database model (#2)
iirisjoutsi May 21, 2022
09a5722
feat: Improve event page button design
biharygergo Jun 11, 2022
80ec715
feat: Cover photo dimensions should be 16/9
biharygergo Jun 12, 2022
dc0e22b
feat: Improve organiser invitation drawer
biharygergo Jun 12, 2022
1ab87dd
calrified timeline -hint
Jun 14, 2022
ba4d5a3
Merge pull request #532 from CadusTech/dev
Eficnbo Jun 15, 2022
981d72b
Merge pull request #534 from biharygergo/improve-event-page-button
Eficnbo Jun 21, 2022
d945394
Merge pull request #536 from biharygergo/improve-organiser-invitation
Eficnbo Jun 21, 2022
ba5838c
Merge pull request #535 from biharygergo/fix-cover-photo-dimensions
Eficnbo Jun 28, 2022
5252d15
Feature/6 Add challenges page to dashboard (#7)
iirisjoutsi Jul 9, 2022
630b252
Merge pull request #549 from CadusTech/dev
Eficnbo Aug 26, 2022
579e833
playground remove
Eficnbo Sep 27, 2022
00f9c05
Bump d3-color and recharts in /frontend
dependabot[bot] Sep 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.DS_Store
scripts/
scripts/
dump/
24 changes: 24 additions & 0 deletions backend/migrations/12-add-timeline-to-event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const mongoose = require('mongoose')
const Promise = require('bluebird')

module.exports = {
index: 12,
name: '12-add-timeline-to-event',
description: 'add timeline event',
run: async () => {
const nres = await mongoose
.model('Event')
.updateMany(
{ eventTimeline: { $exists: false } },
{ $set: { eventTimeline: { items: [] } } },
)
const bres = await mongoose
.model('Event')
.updateMany(
{ eventTimeline: null },
{ $set: { eventTimeline: { items: [] } } },
)
console.info('Done with event timeline', nres.n, nres.nModified)
return Promise.resolve()
},
}
18 changes: 18 additions & 0 deletions backend/migrations/13-set-eventLocation-null-where-not-exists.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const mongoose = require('mongoose')
const Promise = require('bluebird')

module.exports = {
index: 13,
name: '13-set-eventLocation-null-where-not-exists',
description: 'set eventLocation null where not exists',
run: async () => {
const nres = await mongoose
.model('Event')
.updateMany(
{ eventLocation: { $exists: false } },
{ $set: { eventLocation: null } },
)
console.info('Done with event timeline', nres.n, nres.nModified)
return Promise.resolve()
},
}
2 changes: 2 additions & 0 deletions backend/migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const migrations = [
require('./09-sync-registration-to-profiles'),
require('./10-add-banner-priority-and-approved-to-event'),
require('./11-add-organization-to-event'),
require('./12-add-timeline-to-event'),
require('./13-set-eventLocation-null-where-not-exists'),
]

const run = async () => {
Expand Down
9 changes: 9 additions & 0 deletions backend/modules/event/graphql-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ class EventController {
return this._clean(Event.find().lean())
}

async update(id, event) {
if (!this.isAdmin) {
return null
}
return this._clean(
Event.findOneAndUpdate({ _id: id }, event, { new: true }),
)
}

async _clean(promise) {
const result = await promise
if (Array.isArray(result)) {
Expand Down
185 changes: 184 additions & 1 deletion backend/modules/event/graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
GraphQLList,
GraphQLInt,
GraphQLBoolean,
GraphQLInputObjectType,
} = require('graphql')
const { GraphQLDateTime } = require('graphql-iso-date')

Expand All @@ -16,18 +17,171 @@ const dateUtils = require('../../common/utils/dateUtils')

const {
CloudinaryImage,
CloudinaryImageInput,
Address,
AddressInput,
Track,
TrackInput,
Challenge,
ChallengeInput,
TravelGrantConfig,
TravelGrantConfigInput,
RegistrationSection,
RegistrationSectionInput,
EventTag,
EventTagInput,
RegistrationConfig,
RegistrationConfigInput,
EventTheme,
EventThemeInput,
EventTimeline,
EventTimelineInput,
Webhook,
WebhookInput,
} = require('../graphql-shared-types')

const Organization = require('../organization/model')

const EventInput = new GraphQLInputObjectType({
name: 'EventInput',
fields: {
name: {
type: GraphQLString,
},
slug: {
type: GraphQLString,
},
timezone: {
type: GraphQLString,
},
coverImage: {
type: CloudinaryImageInput,
},
logo: {
type: CloudinaryImageInput,
},
eventType: {
type: GraphQLString,
},
description: {
type: GraphQLString,
},
/** Times */
registrationStartTime: {
type: GraphQLDateTime,
},
registrationEndTime: {
type: GraphQLDateTime,
},
startTime: {
type: GraphQLDateTime,
},
endTime: {
type: GraphQLDateTime,
},
submissionsStartTime: {
type: GraphQLDateTime,
},
submissionsEndTime: {
type: GraphQLDateTime,
},
reviewingStartTime: {
type: GraphQLDateTime,
},
reviewingEndTime: {
type: GraphQLDateTime,
},
finalsActive: {
type: GraphQLBoolean,
},
eventLocation: {
type: AddressInput,
},
tracksEnabled: {
type: GraphQLBoolean,
},
tracks: {
type: GraphQLList(TrackInput),
},
challengesEnabled: {
type: GraphQLBoolean,
},
challenges: {
type: GraphQLList(ChallengeInput),
},
travelGrantConfig: {
type: TravelGrantConfigInput,
},
reviewMethod: {
type: GraphQLString,
},
overallReviewMethod: {
type: GraphQLString,
},
customQuestions: {
type: GraphQLList(RegistrationSectionInput),
},
tags: {
type: GraphQLList(EventTagInput),
},
/** System metadata */
published: {
type: GraphQLBoolean,
},
galleryOpen: {
type: GraphQLBoolean,
},
owner: {
type: GraphQLString,
},
organisers: {
type: GraphQLList(GraphQLString),
},
organizations: {
type: GraphQLList(GraphQLID),
},
registrationConfig: {
type: RegistrationConfigInput,
},
demoLabel: {
type: GraphQLString,
},
demoHint: {
type: GraphQLString,
},
eventPrivacy: {
type: GraphQLString,
},
eventTerms: {
type: GraphQLString,
},
eventTimeline: {
type: EventTimelineInput,
},
demoPlaceholder: {
type: GraphQLString,
},
metaDescription: {
type: GraphQLString,
},
finalists: {
type: GraphQLList(GraphQLString),
},
frontPagePriority: {
type: GraphQLInt,
},
approved: {
type: GraphQLBoolean,
},
theme: {
type: EventThemeInput,
},
webhooks: {
type: GraphQLList(WebhookInput),
},
},
})

const EventType = new GraphQLObjectType({
name: 'Event',
fields: () => {
Expand Down Expand Up @@ -113,7 +267,7 @@ const EventType = new GraphQLObjectType({
type: GraphQLList(RegistrationSection),
},
tags: {
type: EventTag,
type: GraphQLList(EventTag),
},
/** System metadata */
published: {
Expand Down Expand Up @@ -146,6 +300,9 @@ const EventType = new GraphQLObjectType({
eventTerms: {
type: GraphQLString,
},
eventTimeline: {
type: EventTimeline,
},
demoPlaceholder: {
type: GraphQLString,
},
Expand All @@ -164,6 +321,9 @@ const EventType = new GraphQLObjectType({
theme: {
type: EventTheme,
},
webhooks: {
type: GraphQLList(Webhook),
},
// Implement userprofile in graphql
// TODO: Figure this stuff out
// winners: {
Expand Down Expand Up @@ -247,6 +407,23 @@ const QueryType = new GraphQLObjectType({
},
})

const MutationType = new GraphQLObjectType({
name: 'Mutation',
fields: {
updateEvent: {
type: EventType,
args: {
_id: {
type: GraphQLNonNull(GraphQLID),
},
event: {
type: GraphQLNonNull(EventInput),
},
},
},
},
})

const Resolvers = {
Query: {
myEvents: async (parent, args, context) => {
Expand Down Expand Up @@ -291,6 +468,11 @@ const Resolvers = {
return events
},
},
Mutation: {
updateEvent: async (parent, args, context) => {
return context.controller('Event').update(args._id, args.event)
},
},
Event: {
organizations: parent => {
return parent.organizations.map(orgId =>
Expand Down Expand Up @@ -326,6 +508,7 @@ const Resolvers = {

module.exports = {
QueryType,
MutationType,
Resolvers,
Types: {
EventType,
Expand Down
5 changes: 5 additions & 0 deletions backend/modules/event/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const RegistrationConfigSchema = require('@hackjunction/shared/schemas/Registrat
const AddressSchema = require('@hackjunction/shared/schemas/Address')
const WebhookSchema = require('@hackjunction/shared/schemas/Webhook')
const EventThemeSchema = require('@hackjunction/shared/schemas/EventTheme')
const EventTimelineSchema = require('@hackjunction/shared/schemas/EventTimeline')
const allowPublishPlugin = require('../../common/plugins/allowPublish')
const updateAllowedPlugin = require('../../common/plugins/updateAllowed')
const uploadHelper = require('../upload/helper')
Expand Down Expand Up @@ -189,6 +190,10 @@ const EventSchema = new mongoose.Schema({
type: [WebhookSchema.mongoose],
default: [],
},
eventTimeline: {
type: EventTimelineSchema.mongoose,
default: { items: [] },
},
metaDescription: {
type: String,
default: '',
Expand Down
4 changes: 2 additions & 2 deletions backend/modules/graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ module.exports = app => {
})
const server = new ApolloServer({
schema,
playground: true,
introspection: true,
playground: false,
introspection: false,
context: ({ req, res }) => ({
req,
res,
Expand Down
Loading