Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Functional Programming
Diskuy-Backend
Commits
5aa4c5ad
Commit
5aa4c5ad
authored
Feb 19, 2021
by
Muhammad Rafif Elfazri
Browse files
Remove Auto Capitalization
parent
1179de49
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/diskuy_web/controllers/topic_controller.ex
View file @
5aa4c5ad
...
@@ -22,15 +22,12 @@ defmodule DiskuyWeb.TopicController do
...
@@ -22,15 +22,12 @@ defmodule DiskuyWeb.TopicController do
end
end
def
show
(
conn
,
%{
"id"
=>
id
})
do
def
show
(
conn
,
%{
"id"
=>
id
})
do
new_id
=
Utility
.
capitalize_string
(
id
)
topic
=
Forum
.
get_topic_by_name!
(
id
)
topic
=
Forum
.
get_topic_by_name!
(
new_id
)
render
(
conn
,
"show.json"
,
topic:
topic
)
render
(
conn
,
"show.json"
,
topic:
topic
)
end
end
def
update
(
conn
,
%{
"id"
=>
id
,
"topic"
=>
topic_params
})
do
def
update
(
conn
,
%{
"id"
=>
id
,
"topic"
=>
topic_params
})
do
new_id
=
Utility
.
capitalize_string
(
id
)
topic
=
Forum
.
get_topic_by_name!
(
id
)
topic
=
Forum
.
get_topic_by_name!
(
new_id
)
with
{
:ok
,
%
Topic
{}
=
topic
}
<-
Forum
.
update_topic
(
topic
,
topic_params
)
do
with
{
:ok
,
%
Topic
{}
=
topic
}
<-
Forum
.
update_topic
(
topic
,
topic_params
)
do
render
(
conn
,
"show.json"
,
topic:
topic
)
render
(
conn
,
"show.json"
,
topic:
topic
)
...
@@ -38,8 +35,7 @@ defmodule DiskuyWeb.TopicController do
...
@@ -38,8 +35,7 @@ defmodule DiskuyWeb.TopicController do
end
end
def
delete
(
conn
,
%{
"id"
=>
id
})
do
def
delete
(
conn
,
%{
"id"
=>
id
})
do
new_id
=
Utility
.
capitalize_string
(
id
)
topic
=
Forum
.
get_topic_by_name!
(
id
)
topic
=
Forum
.
get_topic_by_name!
(
new_id
)
with
{
:ok
,
%
Topic
{}}
<-
Forum
.
delete_topic
(
topic
)
do
with
{
:ok
,
%
Topic
{}}
<-
Forum
.
delete_topic
(
topic
)
do
send_resp
(
conn
,
:no_content
,
""
)
send_resp
(
conn
,
:no_content
,
""
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment