remove: tenantslug

This commit is contained in:
Rogee
2025-01-15 20:31:21 +08:00
parent 13566cfa38
commit dbe1e19be2
24 changed files with 521 additions and 301 deletions

View File

@@ -29,16 +29,10 @@ func (ctl *Controller) Prepare() error {
// Upload
// @Router /api/v1/medias/:tenant/upload [post]
// @Bind tenantSlug path
// @Bind req body
// @Bind file file
// @Bind claim local
func (ctl *Controller) Upload(ctx fiber.Ctx, claim *jwt.Claims, tenantSlug string, file *multipart.FileHeader, req *UploadReq) (*storage.UploadedFile, error) {
tenant, err := ctl.tenantSvc.GetTenantBySlug(ctx.Context(), tenantSlug)
if err != nil {
return nil, err
}
func (ctl *Controller) Upload(ctx fiber.Ctx, claim *jwt.Claims, file *multipart.FileHeader, req *UploadReq) (*storage.UploadedFile, error) {
defaultStorage, err := ctl.storageSvc.GetDefault(ctx.Context())
if err != nil {
return nil, err
@@ -67,7 +61,7 @@ func (ctl *Controller) Upload(ctx fiber.Ctx, claim *jwt.Claims, tenantSlug strin
_, err = ctl.svc.Create(ctx.Context(), &model.Medias{
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
TenantID: tenant.ID,
TenantID: *claim.TenantID,
UserID: claim.UserID,
StorageID: defaultStorage.ID,
Hash: uploadedFile.Hash,