@studiohyperdrive/hal-tools
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "@studiohyperdrive/hal-tools", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -23,3 +23,3 @@ # Studio Hyperdrive HAL Toolset | ||
``` bash | ||
& yarn add @studiohyperdrive/hal-tools | ||
$ yarn add @studiohyperdrive/hal-tools | ||
``` | ||
@@ -33,10 +33,20 @@ | ||
return HALFormat({ | ||
path, | ||
key, | ||
entities, | ||
page, | ||
size, | ||
totalElements, | ||
}); | ||
class DoSomething { | ||
public async findAll(page: number, size: number): Promise<IHALFormat<MyEntity>> { | ||
const [entities, totalElements] = await this.MyEntitiyRepository.findAndCount( | ||
calculateTakeSkip(page, size), | ||
); | ||
const key = 'my-entities'; | ||
const path = `https://my-api.com/v1/api/${key}`; | ||
return HALFormat<MyEntity>({ | ||
path, | ||
key, | ||
entities, | ||
page, | ||
size, | ||
totalElements, | ||
}); | ||
} | ||
} | ||
``` | ||
@@ -43,0 +53,0 @@ |
12485
107