handler

package
v0.0.0-...-836670f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateProgram

func CreateProgram(cc echo.Context) error

func CreateUser

func CreateUser(cc echo.Context) error

CreateUser creates a new user object corresponding to either the provided UID or a random new one if none is provided with the default data.

Request Body:

{
    "uid": string <optional>
}

Returns: Status 200 with a marshalled User struct on success.

func DeleteClass

func DeleteClass(cc echo.Context) error

DeleteClass takes a wid and deletes it. Any programs associated with the class will also be deleted. Users that are in the class will still contain a reference to this class, thus it is the user's responsibility to remove references to a deleted class.

func DeleteProgram

func DeleteProgram(cc echo.Context) error

func DeleteUser

func DeleteUser(cc echo.Context) error

DeleteUser deletes an user along with all their programs from the database.

Request Body:

{
    "uid": REQUIRED
}

Returns: status 200 on deletion.

func GetClass

func GetClass(cc echo.Context) error

GetClass takes the UID (either of a member or an instructor) and a CID (wid) as a JSON, and returns an object representing the class. If the given UID is not a member or an instructor, an error is returned.

func GetClassMembers

func GetClassMembers(cc echo.Context) error

GetClassMembers returns the user IDs and display names of each member in the requested class. It takes a class id and checks that the given uid is in the class first

func GetProgram

func GetProgram(cc echo.Context) error

GetProgram retrieves information about a single program.

Query parameters: pid

Returns status 200 OK with a marshalled Program struct.

func GetUser

func GetUser(cc echo.Context) error

GetUser acquires the user document with the given uid. The provided context must be a *db.DBContext.

Query Parameters:

  • uid string: UID of user to GET
  • programs string: Whether to acquire programs.

Returns: Status 200 with marshalled User and programs.

func JoinClass

func JoinClass(cc echo.Context) error

JoinClass takes a UID and cid(wid) as a JSON, and attempts to add the UID to the class given by cid. The updated struct of the class is returned as a JSON

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL