Skip to content
This repository was archived by the owner on Aug 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
University of Illinois/NCSA Open Source License

Copyright (c) 2016 ACM@UIUC
Copyright (c) 2017 ACM@UIUC
All rights reserved.

Developed by: Groot Development Team
Expand Down
87 changes: 0 additions & 87 deletions services/members.go

This file was deleted.

6 changes: 3 additions & 3 deletions services/services.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Copyright © 2017, ACM@UIUC
*
* This file is part of the Groot Project.
*
* This file is part of the Groot Project.
*
* The Groot Project is open source software, released under the University of
* Illinois/NCSA Open Source License. You should have received a copy of
* this license in a file with the distribution.
Expand Down Expand Up @@ -40,7 +40,7 @@ func Index(w http.ResponseWriter, r *http.Request) {
func RegisterAPIs() {
Routes = append(Routes, AuthRoutes...)
Routes = append(Routes, GroupsRoutes...)
Routes = append(Routes, MembersRoutes...)
Routes = append(Routes, UsersRoutes...)
Routes = append(Routes, QuotesRoutes...)
Routes = append(Routes, RecruitersRoutes...)
Routes = append(Routes, HardwareRoutes...)
Expand Down
98 changes: 98 additions & 0 deletions services/users.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/**
* Copyright © 2017, ACM@UIUC
*
* This file is part of the Groot Project.
*
* The Groot Project is open source software, released under the University of
* Illinois/NCSA Open Source License. You should have received a copy of
* this license in a file with the distribution.
**/

package services

import (
"net/http"

"github.com/acm-uiuc/groot/proxy"
)

//Location
const UsersURL string = "http://localhost:8001"

//Service Data Type
const UsersFormat string = "JSON"

//API Interface
var UsersRoutes = RouteCollection{
Route{
"GetUsers",
"GET",
"/users",
GetUsers,
},
Route{
"IsUser",
"POST",
"/users/{netid}/isUser",
IsUser,
},
Route{
"NewUser",
"POST",
"/users",
NewUser,
},
Route{
"ConfirmUser",
"PUT",
"/users/{user_id}/paid",
ConfirmUser,
},
Route{
"DeleteUser",
"DELETE",
"/users/{user_id}",
DeleteUser,
},
Route{
"UsersLogin",
"POST",
"/users/login",
UsersLogin,
},
Route{
"UsersLogout",
"POST",
"/users/logout",
UsersLogout,
},
}

//Route handler
func GetUsers(w http.ResponseWriter, r *http.Request) {
proxy.GET(w, UsersURL+r.URL.String(), UsersFormat, "", r)
}

func IsUser(w http.ResponseWriter, r *http.Request) {
proxy.POST(w, UsersURL+r.URL.String(), UsersFormat, "", r)
}

func NewUser(w http.ResponseWriter, r *http.Request) {
proxy.POST(w, UsersURL+r.URL.String(), UsersFormat, "", r)
}

func ConfirmUser(w http.ResponseWriter, r *http.Request) {
proxy.PUT(w, UsersURL+r.URL.String(), UsersFormat, "", r)
}

func DeleteUser(w http.ResponseWriter, r *http.Request) {
proxy.DELETE(w, UsersURL+r.URL.String(), UsersFormat, "", r)
}

func UsersLogin(w http.ResponseWriter, r *http.Request) {
proxy.POST(w, UsersURL+r.URL.String(), UsersFormat, "", r)
}

func UsersLogout(w http.ResponseWriter, r *http.Request) {
proxy.POST(w, UsersURL+r.URL.String(), UsersFormat, "", r)
}