Add RevisionsService

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2020-07-26 20:57:28 +02:00
parent b8af7301a1
commit 735980da7c
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
3 changed files with 45 additions and 0 deletions

View file

@ -1,8 +1,11 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm'; import { TypeOrmModule } from '@nestjs/typeorm';
import { Revision } from './revision.entity'; import { Revision } from './revision.entity';
import { RevisionsService } from './revisions.service';
@Module({ @Module({
imports: [TypeOrmModule.forFeature([Revision])], imports: [TypeOrmModule.forFeature([Revision])],
providers: [RevisionsService],
exports: [RevisionsService],
}) })
export class RevisionsModule {} export class RevisionsModule {}

View file

@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { RevisionsService } from './revisions.service';
describe('RevisionsService', () => {
let service: RevisionsService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [RevisionsService],
}).compile();
service = module.get<RevisionsService>(RevisionsService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
});

View file

@ -0,0 +1,24 @@
import { Injectable } from '@nestjs/common';
import { RevisionMetadataDto } from './revision-metadata.dto';
import { RevisionDto } from './revision.dto';
@Injectable()
export class RevisionsService {
getNoteRevisionMetadatas(noteIdOrAlias: string): RevisionMetadataDto[] {
return [
{
id: 'some-uuid',
updatedAt: new Date(),
length: 42,
},
];
}
getNoteRevision(noteIdOrAlias: string, revisionId: string): RevisionDto {
return {
id: revisionId,
content: 'Foobar',
patch: 'barfoo',
};
}
}