envelope-zero/backend

Remove foreign key checks from controllers

Closed this issue · 1 comments

We're currently checking if referenced resources exist in the controller code, e.g.

func createMatchRule(c *gin.Context, matchRule models.MatchRule) (models.MatchRule, httperrors.Error) {
	// Check that the referenced account exists
	_, err := getModelByID[models.Account](c, matchRule.AccountID)
	if !err.Nil() {
		return matchRule, err
	}

…

This should not be needed since the database should check these foreign key references.

Implemented by #965.