project

package
v0.0.0-...-181bd5f Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 8 Imported by: 0

README

Projects

Get all Projects from a student

  • HTTP Request : GET http://api.com/project/{studentid}

  • Return a list of object in json format as follow

    [
        {
            "id"           :	ObjectId,
            "studentid"     :       ObjectID,
            "projecttypeid" :       ObjectID,
            "monitorid"     :	ObjectId,
            "classid"       :	ObjectId,
            "createdat"     :	time.Time,
            "filename"      :	String,
            "status"        :       String
        }...
    ]
    

Update a project status

  • HTTP Request : PUT http://api.com/project/status

  • Send Project's data in the request body in the following format

        {
            "id"           :   ObjectId,
            "status"        :   String
        }
    

Create Project

  • HTTP Request : POST http://api.com/project

  • Send Project's data in the request body in the following format

        {
            "studentid"     :    ObjectID,
            "projecttypeid" :    ObjectID,
            "classid"       :	ObjectID,
            "filename"      :	String,
        }
    
  • http StatusCreated (201) will be sent if the project has been created correctly and will return a JSON in the following format

       {
           "status": "success",
           "content": {
               "monitorEmail": "monitor.email@gmail.com",
               "monitorName": "Monitor Name"
           }
       } 
    

Project Type

Create Project Type

  • HTTP Request : POST http://api.com/project/type

  • Send ProjectType's data in the request body in the following format

  • PS : Only admin with Professor : True can make this request

        {
            "name"          :   String,
            "description"   :   String,
            "ClassID"       :   ObjectID,
            "start"         :   Time,
            "end"           :   Time,
            "score"         :   Float
        }
    

Update Project Type

  • HTTP Request : PUT http://api.com/project/type

  • Send data in the request body in the following format (_id is required)

  • PS : Only admin with Professor : True can make this request

        {
            "id"           :   ObjectID,
            "name"          :   String,
            "description"   :   String,
            "ClassID"       :   ObjectID,
            "start"         :   Time,
            "end"           :   Time,
            "score"         :   Float
        }
    

Delete Project Type

  • HTTP Request : DELETE http://api.com/project/type

  • Send data in the request body in the following format

  • PS : Only admin with Professor : True can make this request

        {  
            "id"	:	ObjectId
        }
    
  • http StatusOK (200) will be sent if the Project Type have been deleted correctly

Documentation

Index

Constants

View Source
const (
	Created   = "Created"
	Updated   = "Updated"
	Pending   = "Pending"
	Received  = "Received"
	Confirmed = "Confirmed"
)

Variables

This section is empty.

Functions

func CreateProject

func CreateProject(db *mongo.Client, projectInfo Project, databaseName string) (interface{}, error)

func CreateProjectType

func CreateProjectType(db *mongo.Client, projectTypeDAO ProjectType, databaseName, collectionName string) error

func DeleteProjectType

func DeleteProjectType(db *mongo.Client, projectTypeDAO ProjectType, databaseName, collectionName string) error

func UpdateProject

func UpdateProject(db *mongo.Client, projectStatus Project, databaseName, collectionName string) error

func UpdateProjectType

func UpdateProjectType(db *mongo.Client, projectTypeDAO ProjectType, databaseName, collectionName string) error

func UpdateStatusProject

func UpdateStatusProject(db *mongo.Client, projectStatus Project, databaseName, collectionName string) error

Types

type Project

type Project struct {
	ID            *primitive.ObjectID `bson:"_id,omitempty"`
	StudentID     primitive.ObjectID  `bson:"studentid,omitempty"`
	ProjectTypeID primitive.ObjectID  `bson:"projectypeid,omitempty"`
	ClassID       primitive.ObjectID  `bson:"classid,omitempty"`
	MonitorID     primitive.ObjectID  `bson:"monitorid,omitempty"`
	MonitorName   string              `json:"monitorname,omitempty"`
	MonitorEmail  string              `json:"monitoremail,omitempty"`
	CreatedAT     time.Time           `json:"createdat,omitempty"`
	UpdatedAT     time.Time           `json:"updatedat,omitempty"`
	FileName      string              `json:"filename,omitempty"`
	Status        string              `json:"status,omitempty"`
	Score         float64             `json:"score,omitempty"`
}

func GetProjects

func GetProjects(db *mongo.Client, studentID primitive.ObjectID, databaseName, collectionName string) ([]Project, error)

type ProjectType

type ProjectType struct {
	ID          *primitive.ObjectID `bson:"_id,omitempty"`
	Name        string              `json:"name"`
	Description string              `json:"description"`
	ClassID     primitive.ObjectID  `bson:"classid,omitempty"`
	Start       time.Time           `json:"start"`
	End         time.Time           `json:"end"`
	Score       float64             `json:"score"`
}

func GetProjectsType

func GetProjectsType(db *mongo.Client, databaseName, collectionName string) ([]ProjectType, error)

Jump to

Keyboard shortcuts

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