Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
b4b125d750 | |||
826f0eaa73 | |||
adddef3188 | |||
3e2faf9554 | |||
744ad9211b | |||
35a116abbb | |||
4cb5b8d814 |
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
include "src/main/nim/personal_measure_apipkg/version.nim"
|
include "src/main/nim/personal_measure_apipkg/version.nim"
|
||||||
|
|
||||||
version = PM_API_VERSION
|
version = "0.8.0"
|
||||||
author = "Jonathan Bernard"
|
author = "Jonathan Bernard"
|
||||||
description = "JDB\'s Personal Measures API"
|
description = "JDB\'s Personal Measures API"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@ -17,5 +17,5 @@ requires @["nim >= 0.19.4", "bcrypt", "docopt >= 0.6.8", "isaac >= 0.1.3",
|
|||||||
"jester >= 0.4.3", "jwt", "tempfile", "uuids >= 0.1.10" ]
|
"jester >= 0.4.3", "jwt", "tempfile", "uuids >= 0.1.10" ]
|
||||||
|
|
||||||
requires "https://git.jdb-labs.com/jdb/nim-cli-utils.git >= 0.6.3"
|
requires "https://git.jdb-labs.com/jdb/nim-cli-utils.git >= 0.6.3"
|
||||||
requires "https://git.jdb-labs.com/jdb/nim-time-utils.git >= 0.5.0"
|
requires "https://git.jdb-labs.com/jdb/nim-time-utils.git >= 0.5.2"
|
||||||
requires "https://git.jdb-labs.com/jdb-labs/fiber-orm-nim.git >= 0.2.0"
|
requires "https://git.jdb-labs.com/jdb-labs/fiber-orm-nim.git >= 0.3.0"
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import asyncdispatch, base64, jester, json, jwt, logging, options, sequtils,
|
import asyncdispatch, base64, jester, json, jwt, logging, options, sequtils,
|
||||||
strutils, times, uuids
|
times, uuids
|
||||||
from unicode import capitalize
|
from unicode import capitalize
|
||||||
import timeutils except `<`
|
import strutils except capitalize
|
||||||
|
import timeutils
|
||||||
|
|
||||||
import ./db, ./configuration, ./models, ./service, ./version
|
import ./db, ./configuration, ./models, ./service, ./version
|
||||||
|
|
||||||
@ -476,7 +477,7 @@ proc start*(ctx: PMApiContext): void =
|
|||||||
|
|
||||||
let newMeasurement = Measurement(
|
let newMeasurement = Measurement(
|
||||||
measureId: measure.id,
|
measureId: measure.id,
|
||||||
value: jsonBody.getOrFail("value").getInt,
|
value: jsonBody.getOrFail("value").getFloat,
|
||||||
timestamp:
|
timestamp:
|
||||||
if jsonBody.hasKey("timestamp"): jsonBody["timestamp"].getStr.parseIso8601.utc
|
if jsonBody.hasKey("timestamp"): jsonBody["timestamp"].getStr.parseIso8601.utc
|
||||||
else: getTime().utc,
|
else: getTime().utc,
|
||||||
@ -515,7 +516,7 @@ proc start*(ctx: PMApiContext): void =
|
|||||||
let measure = ctx.getMeasureForSlug(session.user.id, @"slug")
|
let measure = ctx.getMeasureForSlug(session.user.id, @"slug")
|
||||||
var measurement = ctx.getMeasurementForMeasure(measure.id, parseUUID(@"id"))
|
var measurement = ctx.getMeasurementForMeasure(measure.id, parseUUID(@"id"))
|
||||||
let jsonBody = parseJson(request.body)
|
let jsonBody = parseJson(request.body)
|
||||||
if jsonBody.hasKey("value"): measurement.value = jsonBody["value"].getInt
|
if jsonBody.hasKey("value"): measurement.value = jsonBody["value"].getFloat
|
||||||
if jsonBody.hasKey("timestamp"): measurement.timestamp = jsonBody["timestamp"].getStr.parseIso8601
|
if jsonBody.hasKey("timestamp"): measurement.timestamp = jsonBody["timestamp"].getStr.parseIso8601
|
||||||
if jsonBody.hasKey("extData"): measurement.extData = jsonBody["extData"]
|
if jsonBody.hasKey("extData"): measurement.extData = jsonBody["extData"]
|
||||||
jsonResp($(%ctx.db.updateMeasurement(measurement)))
|
jsonResp($(%ctx.db.updateMeasurement(measurement)))
|
||||||
|
@ -28,7 +28,7 @@ type
|
|||||||
Measurement* = object
|
Measurement* = object
|
||||||
id*: UUID
|
id*: UUID
|
||||||
measureId*: UUID
|
measureId*: UUID
|
||||||
value*: int
|
value*: float
|
||||||
timestamp*: DateTime
|
timestamp*: DateTime
|
||||||
extData*: JsonNode
|
extData*: JsonNode
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
const PM_API_VERSION* = "0.7.0"
|
const PM_API_VERSION* = "0.8.0"
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
-- DOWN script for measure-value-is-numeric (20200216230431)
|
||||||
|
alter table "measurements" alter column "value" type integer;
|
@ -0,0 +1,2 @@
|
|||||||
|
-- UP script for measure-value-is-numeric (20200216230431)
|
||||||
|
alter table "measurements" alter column "value" type numeric;
|
@ -47,9 +47,13 @@ printf ">> Updating /api/src/main/nim/personal_measure_apipkg/version.nim with P
|
|||||||
printf "sed -i \"s/%s/%s/\" api/src/main/nim/personal_measure_apipkg/version.nim" "$lastVersion" "$newVersion"
|
printf "sed -i \"s/%s/%s/\" api/src/main/nim/personal_measure_apipkg/version.nim" "$lastVersion" "$newVersion"
|
||||||
sed -i "s/${lastVersion}/${newVersion}/" api/src/main/nim/personal_measure_apipkg/version.nim
|
sed -i "s/${lastVersion}/${newVersion}/" api/src/main/nim/personal_measure_apipkg/version.nim
|
||||||
|
|
||||||
|
printf ">> Updating /api/personal_measure_api.nimble with version = \"%s\"" "$newVersion"
|
||||||
|
printf "sed -i \"s/%s/%s/\" api/personal_measure_api.nimble" "$lastVersion" "$newVersion"
|
||||||
|
sed -i "s/${lastVersion}/${newVersion}/" api/personal_measure_api.nimble
|
||||||
|
|
||||||
printf ">> Committing new version.\n"
|
printf ">> Committing new version.\n"
|
||||||
printf "git add web/package.json web/package-lock.json api/src/main/nim/personal_measure_apipkg/version.nim"
|
printf "git add web/package.json web/package-lock.json api/src/main/nim/personal_measure_apipkg/version.nim"
|
||||||
git add web/package.json web/package-lock.json api/src/main/nim/personal_measure_apipkg/version.nim
|
git add web/package.json web/package-lock.json api/src/main/nim/personal_measure_apipkg/version.nim api/personal_measure_api.nimble
|
||||||
printf "git commit -m \"Update package version to %s\"\n" "$newVersion"
|
printf "git commit -m \"Update package version to %s\"\n" "$newVersion"
|
||||||
git commit -m "Update package version to ${newVersion}"
|
git commit -m "Update package version to ${newVersion}"
|
||||||
|
|
||||||
|
5456
web/package-lock.json
generated
5456
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "personal-measure-web",
|
"name": "personal-measure-web",
|
||||||
"version": "0.7.0",
|
"version": "0.8.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
@ -10,52 +10,52 @@
|
|||||||
"test:unit": "vue-cli-service test:unit"
|
"test:unit": "vue-cli-service test:unit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-svg-core": "^1.2.15",
|
"@fortawesome/fontawesome-svg-core": "^1.2.27",
|
||||||
"@fortawesome/free-solid-svg-icons": "^5.7.2",
|
"@fortawesome/free-solid-svg-icons": "^5.12.1",
|
||||||
"@fortawesome/vue-fontawesome": "^0.1.5",
|
"@fortawesome/vue-fontawesome": "^0.1.9",
|
||||||
"@types/js-cookie": "^2.2.1",
|
"@types/js-cookie": "^2.2.4",
|
||||||
"@types/jwt-decode": "^2.2.1",
|
"@types/jwt-decode": "^2.2.1",
|
||||||
"@types/lodash.assign": "^4.2.6",
|
"@types/lodash.assign": "^4.2.6",
|
||||||
"@types/lodash.findindex": "^4.6.6",
|
"@types/lodash.findindex": "^4.6.6",
|
||||||
"@types/lodash.merge": "^4.6.5",
|
"@types/lodash.merge": "^4.6.6",
|
||||||
"apexcharts": "^3.6.5",
|
"apexcharts": "^3.15.6",
|
||||||
"axios": "^0.18.1",
|
"axios": "^0.18.1",
|
||||||
"js-cookie": "^2.2.0",
|
"js-cookie": "^2.2.1",
|
||||||
"jwt-decode": "^2.2.0",
|
"jwt-decode": "^2.2.0",
|
||||||
"keen-ui": "^1.1.2",
|
"keen-ui": "^1.2.1",
|
||||||
"lodash.assign": "^4.2.0",
|
"lodash.assign": "^4.2.0",
|
||||||
"lodash.findindex": "^4.6.0",
|
"lodash.findindex": "^4.6.0",
|
||||||
"lodash.keyby": "^4.6.0",
|
"lodash.keyby": "^4.6.0",
|
||||||
"lodash.merge": "^4.6.2",
|
"lodash.merge": "^4.6.2",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
"register-service-worker": "^1.5.2",
|
"register-service-worker": "^1.5.2",
|
||||||
"vue": "^2.6.6",
|
"vue": "^2.6.11",
|
||||||
"vue-apexcharts": "^1.3.2",
|
"vue-apexcharts": "^1.5.2",
|
||||||
"vue-class-component": "^6.0.0",
|
"vue-class-component": "^6.0.0",
|
||||||
"vue-property-decorator": "^7.0.0",
|
"vue-property-decorator": "^7.0.0",
|
||||||
"vue-router": "^3.0.1",
|
"vue-router": "^3.1.5",
|
||||||
"vuejs-smart-table": "0.0.3",
|
"vuejs-smart-table": "0.0.3",
|
||||||
"vuex": "^3.0.1",
|
"vuex": "^3.1.2",
|
||||||
"vuex-module-decorators": "^0.9.8"
|
"vuex-module-decorators": "^0.9.11"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^23.1.4",
|
"@types/jest": "^23.1.4",
|
||||||
"@types/lodash.keyby": "^4.6.6",
|
"@types/lodash.keyby": "^4.6.6",
|
||||||
"@vue/cli-plugin-babel": "^3.4.0",
|
"@vue/cli-plugin-babel": "^3.12.1",
|
||||||
"@vue/cli-plugin-pwa": "^3.4.0",
|
"@vue/cli-plugin-pwa": "^3.12.1",
|
||||||
"@vue/cli-plugin-typescript": "^3.4.0",
|
"@vue/cli-plugin-typescript": "^3.12.1",
|
||||||
"@vue/cli-plugin-unit-jest": "^3.7.0",
|
"@vue/cli-plugin-unit-jest": "^3.12.1",
|
||||||
"@vue/cli-service": "^3.5.3",
|
"@vue/cli-service": "^3.12.1",
|
||||||
"@vue/test-utils": "^1.0.0-beta.20",
|
"@vue/test-utils": "^1.0.0-beta.31",
|
||||||
"babel-core": "7.0.0-bridge.0",
|
"babel-core": "7.0.0-bridge.0",
|
||||||
"lint-staged": "^8.1.0",
|
"lint-staged": "^8.2.1",
|
||||||
"live-server": "^1.2.1",
|
"live-server": "^1.2.1",
|
||||||
"node-sass": "^4.13.1",
|
"node-sass": "^4.13.1",
|
||||||
"sass-loader": "^7.1.0",
|
"sass-loader": "^7.3.1",
|
||||||
"ts-jest": "^23.0.0",
|
"ts-jest": "^23.0.0",
|
||||||
"typescript": "^3.0.0",
|
"typescript": "^3.7.5",
|
||||||
"vue-cli-plugin-webpack-bundle-analyzer": "^1.3.0",
|
"vue-cli-plugin-webpack-bundle-analyzer": "^1.4.0",
|
||||||
"vue-template-compiler": "^2.5.21"
|
"vue-template-compiler": "^2.6.11"
|
||||||
},
|
},
|
||||||
"gitHooks": {
|
"gitHooks": {
|
||||||
"pre-commit": "lint-staged"
|
"pre-commit": "lint-staged"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<div id="app">
|
<div id="app">
|
||||||
<NavBar></NavBar>
|
<NavBar></NavBar>
|
||||||
<router-view class=main />
|
<router-view class=main />
|
||||||
|
<span id="personal-measure-version" hidden>{{ version }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" src="./app.ts"></script>
|
<script lang="ts" src="./app.ts"></script>
|
||||||
|
@ -15,9 +15,10 @@ export class SimpleDetails extends Vue {
|
|||||||
// private newMeasurement;
|
// private newMeasurement;
|
||||||
private moment = moment;
|
private moment = moment;
|
||||||
private chartOptions = {
|
private chartOptions = {
|
||||||
|
markers: { size: 6 },
|
||||||
noData: { text: 'no data',
|
noData: { text: 'no data',
|
||||||
style: { fontSize: '18px' } },
|
style: { fontSize: '18px' } },
|
||||||
stroke: { curve: 'smooth' },
|
stroke: { curve: 'straight' },
|
||||||
xaxis: { type: 'datetime' }
|
xaxis: { type: 'datetime' }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="measure.config.isVisible" class="measure-summary" :data-name="'measure-' + measure.slug">
|
<div v-if="measure.config.isVisible" v-bind:key="measure.slug" class="measure-summary" :data-name="'measure-' + measure.slug">
|
||||||
<h2><router-link
|
<h2><router-link
|
||||||
:to="'/measures/' + measure.slug">
|
:to="'/measures/' + measure.slug">
|
||||||
{{measure.name}}</router-link></h2>
|
{{measure.name}}</router-link></h2>
|
||||||
|
@ -9,14 +9,14 @@ export class SimpleSummaryGraph extends Vue {
|
|||||||
private chartOptions = {
|
private chartOptions = {
|
||||||
chart: { sparkline: { enabled: true } },
|
chart: { sparkline: { enabled: true } },
|
||||||
grid: { padding: { top: 20 }},
|
grid: { padding: { top: 20 }},
|
||||||
stroke: { curve: 'smooth' },
|
stroke: { curve: 'straight' },
|
||||||
noData: { text: 'no data',
|
noData: { text: 'no data',
|
||||||
style: { fontSize: '18px' } },
|
style: { fontSize: '18px' } },
|
||||||
xaxis: { type: 'datetime' }
|
xaxis: { type: 'datetime' }
|
||||||
};
|
};
|
||||||
|
|
||||||
private get measurementData(): ApexAxisChartSeries {
|
private get measurementData(): ApexAxisChartSeries {
|
||||||
let measurementData = this.measurements.slice() || [];
|
const measurementData = this.measurements.slice() || [];
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
name: this.measure.name,
|
name: this.measure.name,
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for=measurementValue>{{measure.name}}</label>
|
<label for=measurementValue>{{measure.name}}</label>
|
||||||
<input required type=number v-model=value.value :disabled=disabled />
|
<input name=measurementValue required type=number step=any v-model.number=value.value :disabled=disabled />
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</template>
|
</template>
|
||||||
|
@ -5,7 +5,7 @@ import { Measure, MeasureConfig, MeasureType, Measurement, MeasurementMeta } fro
|
|||||||
export class SimpleEntry extends Vue {
|
export class SimpleEntry extends Vue {
|
||||||
@Prop() public measure!: Measure<MeasureConfig>;
|
@Prop() public measure!: Measure<MeasureConfig>;
|
||||||
@Prop() public value!: Measurement<MeasurementMeta>;
|
@Prop() public value!: Measurement<MeasurementMeta>;
|
||||||
@Prop() public disabled: boolean = false;
|
@Prop() public disabled!: boolean;
|
||||||
private editTimestamp: boolean = false;
|
private editTimestamp: boolean = false;
|
||||||
|
|
||||||
@Watch('value', { immediate: true, deep: true })
|
@Watch('value', { immediate: true, deep: true })
|
||||||
|
@ -54,7 +54,7 @@ export class MeasurementStoreModule extends VuexModule {
|
|||||||
const newMeasurements = existing.slice();
|
const newMeasurements = existing.slice();
|
||||||
|
|
||||||
const index = findIndex(existing, { id: measurement.id });
|
const index = findIndex(existing, { id: measurement.id });
|
||||||
if (index > 0) { newMeasurements.push(measurement); }
|
if (index < 0) { newMeasurements.push(measurement); }
|
||||||
else { newMeasurements[index] = measurement; }
|
else { newMeasurements[index] = measurement; }
|
||||||
this.measurements = assign({}, this.measurements, { [measure.id]: newMeasurements });
|
this.measurements = assign({}, this.measurements, { [measure.id]: newMeasurements });
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
.user-account {
|
.user-account {
|
||||||
|
justify-content: flex-start;
|
||||||
|
|
||||||
section {
|
section {
|
||||||
margin-top: 1rem;
|
margin-top: 2rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user