mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
feat(api): setup nestjs
This commit is contained in:
commit
db62d5d908
25 changed files with 10115 additions and 0 deletions
3
src/connections/connection-type.enum.ts
Normal file
3
src/connections/connection-type.enum.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export enum ConnectionType {
|
||||
SPOTIFY = "spotify"
|
||||
}
|
||||
14
src/connections/connection.entity.ts
Normal file
14
src/connections/connection.entity.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { ConnectionType } from "./connection-type.enum";
|
||||
|
||||
@Entity()
|
||||
export class Connection {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column()
|
||||
userID: string;
|
||||
|
||||
@Column()
|
||||
type: ConnectionType;
|
||||
}
|
||||
18
src/connections/connections.controller.spec.ts
Normal file
18
src/connections/connections.controller.spec.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { Test, TestingModule } from "@nestjs/testing";
|
||||
import { ConnectionsController } from "./connections.controller";
|
||||
|
||||
describe("Connections Controller", () => {
|
||||
let controller: ConnectionsController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [ConnectionsController]
|
||||
}).compile();
|
||||
|
||||
controller = module.get<ConnectionsController>(ConnectionsController);
|
||||
});
|
||||
|
||||
it("should be defined", () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
||||
4
src/connections/connections.controller.ts
Normal file
4
src/connections/connections.controller.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import { Controller } from "@nestjs/common";
|
||||
|
||||
@Controller("connections")
|
||||
export class ConnectionsController {}
|
||||
12
src/connections/connections.module.ts
Normal file
12
src/connections/connections.module.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { Module } from "@nestjs/common";
|
||||
import { TypeOrmModule } from "@nestjs/typeorm";
|
||||
import { ConnectionsController } from "./connections.controller";
|
||||
import { ConnectionsRepository } from "./connections.repository";
|
||||
import { ConnectionsService } from "./connections.service";
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([ConnectionsRepository])],
|
||||
controllers: [ConnectionsController],
|
||||
providers: [ConnectionsService]
|
||||
})
|
||||
export class ConnectionsModule {}
|
||||
5
src/connections/connections.repository.ts
Normal file
5
src/connections/connections.repository.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { EntityRepository, Repository } from "typeorm";
|
||||
import { Connection } from "./connection.entity";
|
||||
|
||||
@EntityRepository(Connection)
|
||||
export class ConnectionsRepository extends Repository<Connection> {}
|
||||
18
src/connections/connections.service.spec.ts
Normal file
18
src/connections/connections.service.spec.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { Test, TestingModule } from "@nestjs/testing";
|
||||
import { ConnectionsService } from "./connections.service";
|
||||
|
||||
describe("ConnectionsService", () => {
|
||||
let service: ConnectionsService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [ConnectionsService]
|
||||
}).compile();
|
||||
|
||||
service = module.get<ConnectionsService>(ConnectionsService);
|
||||
});
|
||||
|
||||
it("should be defined", () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
7
src/connections/connections.service.ts
Normal file
7
src/connections/connections.service.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { Injectable } from "@nestjs/common";
|
||||
import { ConnectionsRepository } from "./connections.repository";
|
||||
|
||||
@Injectable()
|
||||
export class ConnectionsService {
|
||||
constructor(private readonly connectionRepository: ConnectionsRepository) {}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue