-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
1,563 additions
and
1,304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
73 changes: 0 additions & 73 deletions
73
prisma/migrations/20230824075639_add_isdeleted/migration.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Global, Module } from "@nestjs/common"; | ||
import { ConfigService } from "@nestjs/config"; | ||
import { PrismaService } from "../prisma/prisma.service"; | ||
|
||
@Global() | ||
@Module({ | ||
providers: [ConfigService, PrismaService], | ||
exports: [PrismaService], | ||
}) | ||
export class SupabaseModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Injectable } from "@nestjs/common"; | ||
import { Express } from "express"; | ||
import * as fs from "fs"; | ||
import { Multer } from "multer"; | ||
import { createClient } from "@supabase/supabase-js"; | ||
import { timestamp } from "rxjs"; | ||
import * as timers from "timers"; | ||
|
||
const supabase = createClient( | ||
// TODO: implement config service and constructor | ||
"", | ||
"", | ||
); | ||
|
||
@Injectable() | ||
export class SupabaseService { | ||
async uploadFile(file: Express.Multer.File) { | ||
const time = Date.now(); | ||
const { data, error } = await supabase.storage | ||
.from("EzMs-bucket") | ||
.upload( | ||
`/data/${file.originalname}-${time}.${ | ||
file.mimetype.split("/")[1] | ||
}`, | ||
file.buffer, | ||
); | ||
|
||
console.log(data); | ||
|
||
if (error) { | ||
// Handle error | ||
throw error; | ||
} else { | ||
return data.path; | ||
} | ||
} | ||
} |