Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
Web Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gitoukiev, Amir (UG - Surrey Law School)
Web Project
Commits
ba3be020
Commit
ba3be020
authored
3 years ago
by
Treadway, Ross T (UG - Computer Science)
Browse files
Options
Downloads
Patches
Plain Diff
Adding my_created_events, and my_event
parent
055497b3
Branches
42-views-and-layouts
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/controllers/events_controller.rb
+19
-0
19 additions, 0 deletions
app/controllers/events_controller.rb
app/models/event.rb
+2
-0
2 additions, 0 deletions
app/models/event.rb
config/routes.rb
+3
-1
3 additions, 1 deletion
config/routes.rb
with
24 additions
and
1 deletion
app/controllers/events_controller.rb
+
19
−
0
View file @
ba3be020
...
@@ -7,6 +7,25 @@ class EventsController < ApplicationController
...
@@ -7,6 +7,25 @@ class EventsController < ApplicationController
render
json:
@events
render
json:
@events
end
end
def
my_created_events
events
=
Event
.
where
(
creator:
params
[
"id"
])
if
events
.
empty?
render
json:
{
"error"
:
"no events found"
},
status: :not_found
else
render
json:
events
end
end
def
my_events
id
=
params
[
"id"
]
events
=
Event
.
where
(
"? = ANY (invitees)"
,
id
)
if
events
.
empty?
render
json:
{
"error"
:
"no events found"
},
status: :not_found
else
render
json:
events
end
end
# GET /events/1
# GET /events/1
def
show
def
show
render
json:
@event
render
json:
@event
...
...
This diff is collapsed.
Click to expand it.
app/models/event.rb
+
2
−
0
View file @
ba3be020
class
Event
<
ApplicationRecord
class
Event
<
ApplicationRecord
#TODO: validation
end
end
This diff is collapsed.
Click to expand it.
config/routes.rb
+
3
−
1
View file @
ba3be020
...
@@ -7,6 +7,8 @@ Rails.application.routes.draw do
...
@@ -7,6 +7,8 @@ Rails.application.routes.draw do
post
"events"
,
to:
"events#create"
post
"events"
,
to:
"events#create"
put
"events"
,
to:
"events#update"
put
"events"
,
to:
"events#update"
delete
"events"
,
to:
"events#destroy"
delete
"events"
,
to:
"events#destroy"
post
"my_created_events"
,
to:
"events#my_created_events"
post
"my_events"
,
to:
"events#my_events"
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment