Skip to content
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

Closed
wants to merge 29 commits into from

Conversation

SohamGhugare
Copy link

No description provided.

Comment on lines 20 to 24
sponGroup.POST("/create", controllers.CreateSponsorship)
sponGroup.GET("/", controllers.GetSponsorships)
sponGroup.GET("/:id", controllers.GetSponsorshipById)
sponGroup.GET("/update", controllers.UpdateSponsorshipStatus)
sponGroup.DELETE("/", controllers.DeleteSponsorship)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no auth middleware?

Copy link
Author

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

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?

api/database/tables/users.go Outdated Show resolved Hide resolved
Comment on lines +33 to +36
tx := database.DB.First(&spon, "id = ?", id)
if tx.Error != nil {
return tx.Error
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate the db layer

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can u elaborate please?

Comment on lines 3 to 9
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)"`
}
Copy link
Member

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

Copy link
Author

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

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

Comment on lines +43 to +54
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,
})
}
Copy link
Member

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elaborate please

api/utility/passwords.go Outdated Show resolved Hide resolved
@BearTS
Copy link
Member

BearTS commented Dec 19, 2023

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

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

@Dhruv9449
Copy link

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

@Dhruv9449 Dhruv9449 closed this Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants