aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/utils.ts')
-rw-r--r--server/helpers/utils.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts
index f326210f3..af5be0c69 100644
--- a/server/helpers/utils.ts
+++ b/server/helpers/utils.ts
@@ -14,19 +14,19 @@ function generateRandomString (size: number) {
14} 14}
15 15
16interface FormatableToJSON { 16interface FormatableToJSON {
17 toFormatedJSON () 17 toFormattedJSON ()
18} 18}
19 19
20function getFormatedObjects<U, T extends FormatableToJSON> (objects: T[], objectsTotal: number) { 20function getFormattedObjects<U, T extends FormatableToJSON> (objects: T[], objectsTotal: number) {
21 const formatedObjects: U[] = [] 21 const formattedObjects: U[] = []
22 22
23 objects.forEach(object => { 23 objects.forEach(object => {
24 formatedObjects.push(object.toFormatedJSON()) 24 formattedObjects.push(object.toFormattedJSON())
25 }) 25 })
26 26
27 const res: ResultList<U> = { 27 const res: ResultList<U> = {
28 total: objectsTotal, 28 total: objectsTotal,
29 data: formatedObjects 29 data: formattedObjects
30 } 30 }
31 31
32 return res 32 return res
@@ -52,6 +52,6 @@ function isSignupAllowed () {
52export { 52export {
53 badRequest, 53 badRequest,
54 generateRandomString, 54 generateRandomString,
55 getFormatedObjects, 55 getFormattedObjects,
56 isSignupAllowed 56 isSignupAllowed
57} 57}