mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -05:00
Add RevisionsService
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
b8af7301a1
commit
735980da7c
3 changed files with 45 additions and 0 deletions
|
@ -1,8 +1,11 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { Revision } from './revision.entity';
|
||||
import { RevisionsService } from './revisions.service';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([Revision])],
|
||||
providers: [RevisionsService],
|
||||
exports: [RevisionsService],
|
||||
})
|
||||
export class RevisionsModule {}
|
||||
|
|
18
src/revisions/revisions.service.spec.ts
Normal file
18
src/revisions/revisions.service.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
24
src/revisions/revisions.service.ts
Normal file
24
src/revisions/revisions.service.ts
Normal 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',
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue