Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
#41-disabled eslint warning in template, added types and license
Browse files Browse the repository at this point in the history
  • Loading branch information
bariela committed Sep 23, 2021
1 parent fa92c45 commit b4d1f89
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions functions/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "Functions",
"version": "1.0.0",
"private": true,
"description": "Functions processing data and storing it to database",
"main": "index.ts",
"license": "GPL-3.0-or-later",
"scripts": {
"build": "tsc",
"copyymls": "copyfiles --error --up 1 data/* /home/site/wwwroot/dist/data",
Expand Down
11 changes: 9 additions & 2 deletions functions/templates/calculationTemplate/calculation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { Attribute } from './types';
import { Attribute, AttributesFromDB } from './types';

const calculate = (dataFromDatabase): Array<Attribute> => {
/**
* Calculates new attributes
* TODO describe used formula
* @param {} dataFromDatabase
* @returns Array
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
const calculate = (dataFromDatabase: Array<AttributesFromDB>): Array<Attribute> => {
return [];
};

Expand Down
4 changes: 2 additions & 2 deletions functions/templates/calculationTemplate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AzureFunction, Context } from '@azure/functions';
import { initializeDBConnection, getFromDb, storeToDb } from './db';
import { COLLECTION_NAME } from './constants';
import calculate from './calculation';
import { Attribute, AttributesFilter } from './types';
import { Attribute, AttributesFilter, AttributesFromDB } from './types';

/**
* Function triggered by new message in Azure Storage Queue.
Expand All @@ -27,7 +27,7 @@ const calculationTemplate: AzureFunction = async (context: Context): Promise<voi
// Get values from database
// TODO: add attributes and dates for required data
const attributeFilters: Array<AttributesFilter> = [];
const dataFromDatabase = await getFromDb(attributeFilters);
const dataFromDatabase: Array<AttributesFromDB> = await getFromDb(attributeFilters);

// calculations
const calculatedAttributes: Array<Attribute> = await calculate(dataFromDatabase);
Expand Down
5 changes: 5 additions & 0 deletions functions/templates/calculationTemplate/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ export interface AttributesFilter {
date: string;
attributeId: string;
}

export interface AttributesFromDB {
_id: { featureId: string };
features: Array<Attribute>;
}

0 comments on commit b4d1f89

Please sign in to comment.