Skip to content
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
6 changes: 3 additions & 3 deletions handlers/admin_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
ResolvedAll PostStatus = "resolved_all" // defaults to closed post
)

// AdminFacultyPostStatus sets the stage of the faculty posts
// AdminFacultyPostStatus sets the status of the faculty posts
// Sends email to the corresponding post using goroutines
func (h *AdminHandler) AdminFacultyPostStatus(c *gin.Context) {
adminEmail, exists := c.Get(middleware.EmailKey)
Expand Down Expand Up @@ -343,7 +343,7 @@ func (h *AdminHandler) AdminFacultyPostStatus(c *gin.Context) {
}


// AdminWardenPostStatus sets the stage of the warden posts
// AdminWardenPostStatus sets the status of the warden posts
// Sends email to the corresponding post using goroutines
func (h *AdminHandler) AdminWardenPostStatus(c *gin.Context) {
adminEmail, exists := c.Get(middleware.EmailKey)
Expand Down Expand Up @@ -649,7 +649,7 @@ func (h *AdminHandler) AdminWardenPostStatus(c *gin.Context) {
}


// AdminCentreheadPostStatus sets the stage of the centrehead posts
// AdminCentreheadPostStatus sets the status of the centrehead posts
// Sends email to the corresponding post using goroutines
func (h *AdminHandler) AdminCentreheadPostStatus(c *gin.Context) {
adminEmail, exists := c.Get(middleware.EmailKey)
Expand Down
10 changes: 0 additions & 10 deletions models/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ const (
StatusResolved PostStatus = "resolved_all" // defaults to closed post
)

type PostStage string
const (
StageXEN PostStage = "XEN"
StageAE PostStage = "AE"
StageJE PostStage = "JE"
)

type FacultyPost struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
FacultyID uint `gorm:"not null" json:"faculty_id"`
Expand All @@ -49,7 +42,6 @@ type FacultyPost struct {
Title string `gorm:"type:varchar(50);not null" json:"title" binding:"required"`
Description string `gorm:"type:text;not null" json:"description" binding:"required"`
Status string `gorm:"type:varchar(20);not null;default:'pending_xen'" json:"status"`
Stage PostStage `gorm:"type:varchar(20);not null;default:'XEN'" json:"stage"`
AssignedJE_ID *uint `json:"assigned_je_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Expand All @@ -66,7 +58,6 @@ type WardenPost struct {
Title string `gorm:"not null" json:"title" binding:"required"`
Description string `gorm:"type:text;not null" json:"description" binding:"required"`
Status string `gorm:"type:varchar(20);not null;default:'pending_xen'" json:"status"`
Stage PostStage `gorm:"type:varchar(20);not null;default:'XEN'" json:"stage"`
AssignedJE_ID *uint `json:"assigned_je_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Expand All @@ -82,7 +73,6 @@ type CentreheadPost struct {
Title string `gorm:"not null" json:"title" binding:"required"`
Description string `gorm:"type:text;not null" json:"description" binding:"required"`
Status string `gorm:"type:varchar(20);not null;default:'pending_xen'" json:"status"`
Stage PostStage `gorm:"type:varchar(20);not null;default:'XEN'" json:"stage"`
AssignedJE_ID *uint `json:"assigned_je_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Expand Down
8 changes: 4 additions & 4 deletions routes/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ func AdminRoutes (e *gin.Engine, h *handlers.AdminHandler) {
e.DELETE("/api/admin/comment/:type/:id/:comment_id", middleware.IsAuthenticated(), h.AdminDeleteComment)

// keep separate apis for updating status
stage := e.Group("/api/admin")
status := e.Group("/api/admin")
{
stage.PATCH("/faculty_posts/status/:post_id", middleware.IsAuthenticated(), h.AdminFacultyPostStatus)
stage.PATCH("/warden_posts/status/:post_id", middleware.IsAuthenticated(), h.AdminWardenPostStatus)
stage.PATCH("/centrehead_posts/status/:post_id", middleware.IsAuthenticated(), h.AdminCentreheadPostStatus)
status.PATCH("/faculty_posts/status/:post_id", middleware.IsAuthenticated(), h.AdminFacultyPostStatus)
status.PATCH("/warden_posts/status/:post_id", middleware.IsAuthenticated(), h.AdminWardenPostStatus)
status.PATCH("/centrehead_posts/status/:post_id", middleware.IsAuthenticated(), h.AdminCentreheadPostStatus)
}

// get the posts according to the status
Expand Down
Loading