-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added sponsorship crud #1
Conversation
api/controllers/mapRoutes.go
Outdated
sponGroup.POST("/create", controllers.CreateSponsorship) | ||
sponGroup.GET("/", controllers.GetSponsorships) | ||
sponGroup.GET("/:id", controllers.GetSponsorshipById) | ||
sponGroup.GET("/update", controllers.UpdateSponsorshipStatus) | ||
sponGroup.DELETE("/", controllers.DeleteSponsorship) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no auth middleware?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, they are public endpoints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? It doesn't make sense for everyone to have access to it?
tx := database.DB.First(&spon, "id = ?", id) | ||
if tx.Error != nil { | ||
return tx.Error | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate the db layer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can u elaborate please?
api/database/tables/sponsorships.go
Outdated
type Sponsorships struct { | ||
ID int `gorm:"column:id;primaryKey;autoIncrement"` | ||
PocID int `gorm:"column:poc_id;not null"` | ||
Email string `gorm:"column:email;type:varchar(100)"` | ||
Status string `gorm:"column:status;not null;type:varchar(100)"` | ||
Description string `gorm:"column:description;type:varchar(500)"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have an option to have multiple emails
Also need another option to see who submitted the sponsorship
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated that to CurrentEmail, other emails will be stored in Updates field
who submitted the sponsorship
thats PocID, it will be autofilled in the frontend by the logged in user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where are you storing the company name, company PoCs, their contacts etc
func GetSponsorshipById(c *gin.Context) { | ||
id := c.Param("id") | ||
idInt, _ := strconv.Atoi(id) | ||
spon, err := database.GetSponsorshipById(idInt) | ||
if err != nil { | ||
utility.GinCtxError(c, err.Error()) | ||
return | ||
} | ||
c.JSON(http.StatusOK, gin.H{ | ||
"sponsorship": spon, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a separate Controller and service layer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elaborate please
Also please add JWT |
CurrentEmail string `gorm:"column:email;type:varchar(100)"` | ||
Status string `gorm:"column:status;not null;type:varchar(100)"` | ||
Description string `gorm:"column:description;type:varchar(500)"` | ||
Updates []Updates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does updates field mean? and why is it being used for other emails? Also ideally it would be nice to store Company PoC, their name, email, position. Another model for it would be ideal
Also I don't understand your workflow that well. When tracking sponsorships for an event, you need an event object for every new event, also if we want to scale it to multiple orgs, ability to make it multi-tenant was what i had in mind with this project. Current functionality is not that different from an excel sheet that we currently use |
No description provided.