You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: list_discount_codes.go
    path of file: ./repos/dotenx/ao-api/controllers/ecommerce
    
    the code of the file until where you have to start completion: package ecommerce

import (
	"net/http"

	"github.com/gin-gonic/gin"
	"github.com/sirupsen/logrus"
)

func (ec *EcommerceController) ListDiscountCodes() gin.HandlerFunc {
	return func(c *gin.Context) {

		projectTag := c.Param("project_tag")
		// accountId, _ := utils.GetAccountId(c)

		project, err := ec.ProjectService.GetProjectByT
    
func (ec *EcommerceController) ListDiscountCodes() gin.HandlerFunc {
	return func(c *gin.Context) {

		projectTag := c.Param("project_tag")
		// accountId, _ := utils.GetAccountId(c)

		project, err := ec.ProjectService.GetProjectByTag(projectTag)
		if err != nil {
			logrus.Error(err.Error())
			c.JSON(http.StatusBadRequest, gin.H{
				"message": err.Error(),
			})
			return
		}
		if project.Type != "ecommerce" {
			c.JSON(http.StatusBadRequest, gin.H{
				"message": "this project isn't an 'ecommerce' project",
			})
			return
		}

		findDiscountCodesQuery := `
			select * from discount_codes;`
		findDiscountCodesRes, err := ec.DatabaseService.RunDatabaseQuery(projectTag, findDiscountCodesQuery)
		if err != nil {
			logrus.Error(err.Error())
			c.JSON(http.StatusBadRequest, gin.H{
				"message": err.Error(),
			})
			return
		}
		dCodeRows, ok := findDiscountCodesRes["rows"].([]map[string]interface{})
		if !ok {
			c.JSON(http.StatusInternalServerError, gin.H{
				"error": "internal server error",
			})
			return
		}

		c.JSON(http.StatusOK, gin.H{
			"discount_codes": dCodeRows,
		})
	}
}