mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-04-19 13:33:13 +02:00
19 lines
477 B
TypeScript
19 lines
477 B
TypeScript
|
|
import { Injectable } from "@nestjs/common";
|
||
|
|
import { ConfigService } from "@nestjs/config";
|
||
|
|
import { PrismaClient } from "@prisma/client";
|
||
|
|
|
||
|
|
@Injectable()
|
||
|
|
export class PrismaService extends PrismaClient {
|
||
|
|
constructor(config: ConfigService) {
|
||
|
|
super({
|
||
|
|
datasources: {
|
||
|
|
db: {
|
||
|
|
url: config.get("DB_URL"),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|
||
|
|
console.log(config.get("DB_URL"));
|
||
|
|
super.$connect().then(() => console.info("Connected to the database"));
|
||
|
|
}
|
||
|
|
}
|