Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design2
/
2016104120
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Ma Suhyeon
2021-05-02 17:01:57 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
51c3d7c9e29bb77b213b94712b9eb833f7ad9010
51c3d7c9
1 parent
2b464ef3
Implement get extractions
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
src/server/app.go
src/server/extraction.go
src/server/app.go
View file @
51c3d7c
...
...
@@ -59,6 +59,7 @@ func NewApp(config Config) *App {
app
.
echo
.
POST
(
"/users"
,
app
.
PostUsers
)
app
.
echo
.
POST
(
"/users/tokens"
,
app
.
PostTokens
)
app
.
echo
.
GET
(
"/extractions"
,
app
.
GetExtractions
,
auth
)
app
.
echo
.
POST
(
"/extractions"
,
app
.
PostExtractions
,
auth
)
extraction
:=
app
.
echo
.
Group
(
"/extractions/:no"
)
...
...
src/server/extraction.go
View file @
51c3d7c
...
...
@@ -15,6 +15,27 @@ import (
_
"github.com/mattn/go-sqlite3"
)
func
(
app
*
App
)
GetExtractions
(
c
echo
.
Context
)
error
{
userNo
:=
c
.
Get
(
"user"
)
.
(
*
jwt
.
Token
)
.
Claims
.
(
*
AuthClaims
)
.
UserNo
phone
:=
c
.
QueryParam
(
"phone"
)
extractions
:=
[]
uint64
{}
var
err
error
if
phone
==
""
{
query
:=
"SELECT `no` FROM extractions WHERE `owner`=?"
err
=
app
.
db
.
Select
(
&
extractions
,
query
,
userNo
)
}
else
{
query
:=
"SELECT `no` FROM extractions WHERE `owner`=? AND `phone`=?"
err
=
app
.
db
.
Select
(
&
extractions
,
query
,
userNo
,
phone
)
}
if
err
!=
nil
{
return
err
}
return
c
.
JSON
(
http
.
StatusOK
,
extractions
)
}
func
(
app
*
App
)
PostExtractions
(
c
echo
.
Context
)
error
{
userNo
:=
c
.
Get
(
"user"
)
.
(
*
jwt
.
Token
)
.
Claims
.
(
*
AuthClaims
)
.
UserNo
...
...
Please
register
or
login
to post a comment