diff --git a/LICENSE b/LICENSE index a5a0dcd..dc43b1f 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/services/members.go b/services/members.go deleted file mode 100644 index b58d575..0000000 --- a/services/members.go +++ /dev/null @@ -1,87 +0,0 @@ -/** -* 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 MembersURL string = "http://localhost:8001" - -//Service Data Type -const MembersFormat string = "JSON" - -//API Interface -var MembersRoutes = RouteCollection{ - Route{ - "PreMembers", - "POST", - "/users/pre", - PreMembers, - }, - Route{ - "CurrentMembers", - "POST", - "/users/current", - CurrentMembers, - }, - Route{ - "MemberInfo", - "POST", - "/users/{netid}", - MemberInfo, - }, - Route{ - "IsMember", - "POST", - "/users/{netid}/isMember", - IsMember, - }, - Route{ - "NewMember", - "POST", - "/users/newUser", - NewMember, - }, - Route{ - "ConfirmMember", - "POST", - "/users/paid", - ConfirmMember, - }, -} - -//Route handler -func PreMembers(w http.ResponseWriter, r *http.Request) { - proxy.POST(w, MembersURL+r.URL.String(), MembersFormat, "", r) -} - -func CurrentMembers(w http.ResponseWriter, r *http.Request) { - proxy.POST(w, MembersURL+r.URL.String(), MembersFormat, "", r) -} - -func MemberInfo(w http.ResponseWriter, r *http.Request) { - proxy.POST(w, MembersURL+r.URL.String(), MembersFormat, "", r) -} - -func IsMember(w http.ResponseWriter, r *http.Request) { - proxy.POST(w, MembersURL+r.URL.String(), MembersFormat, "", r) -} - -func NewMember(w http.ResponseWriter, r *http.Request) { - proxy.POST(w, MembersURL+r.URL.String(), MembersFormat, "", r) -} - -func ConfirmMember(w http.ResponseWriter, r *http.Request) { - proxy.POST(w, MembersURL+r.URL.String(), MembersFormat, "", r) -} diff --git a/services/services.go b/services/services.go index 0c08b9c..5e0a0f0 100644 --- a/services/services.go +++ b/services/services.go @@ -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. @@ -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...) diff --git a/services/users.go b/services/users.go new file mode 100644 index 0000000..b524b42 --- /dev/null +++ b/services/users.go @@ -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) +}