package api

import (
	"3dshow-customer/db/repo"

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

func Supply(r *GinRouter) {
	r.GET("/supply/list", supplyList)
}

func supplyList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
	page, size, query := UtilQueryPageSize(c)
	return repo.RepoPageSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
		Db:          "supply-user",
		CollectName: "users",
		Page:        page,
		Size:        size,
		Query:       query,
		Project:     []string{"_id", "name", "avatar", "email"},
		Sort:        repo.Map{"createTime": -1},
	})

}
