From 7c638d066ea8326b1eeb4d0290456b2539b40f74 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Sun, 5 Feb 2023 11:30:50 +0100 Subject: [PATCH] Added submission page, momentjs, and UTC timezone for all services. --- .../gymboard_api/GymboardApiApplication.java | 3 ++ gymboard-app/package-lock.json | 14 +++++++++ gymboard-app/package.json | 1 + gymboard-app/quasar.config.js | 2 +- gymboard-app/src/api/main/submission.ts | 14 ++++++++- gymboard-app/src/pages/SubmissionPage.vue | 29 +++++++++++++++++++ gymboard-app/src/router/routes.ts | 2 ++ .../gymboardcdn/GymboardCdnApplication.java | 3 ++ .../GymboardSearchApplication.java | 3 ++ runner.d | 22 ++++++++++++++ 10 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 gymboard-app/src/pages/SubmissionPage.vue create mode 100644 runner.d diff --git a/gymboard-api/src/main/java/nl/andrewlalis/gymboard_api/GymboardApiApplication.java b/gymboard-api/src/main/java/nl/andrewlalis/gymboard_api/GymboardApiApplication.java index 9a56fcd..ee5ea61 100644 --- a/gymboard-api/src/main/java/nl/andrewlalis/gymboard_api/GymboardApiApplication.java +++ b/gymboard-api/src/main/java/nl/andrewlalis/gymboard_api/GymboardApiApplication.java @@ -3,10 +3,13 @@ package nl.andrewlalis.gymboard_api; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import java.util.TimeZone; + @SpringBootApplication public class GymboardApiApplication { public static void main(String[] args) { + TimeZone.setDefault(TimeZone.getTimeZone("UTC")); SpringApplication.run(GymboardApiApplication.class, args); } diff --git a/gymboard-app/package-lock.json b/gymboard-app/package-lock.json index 936d046..1fb0ff1 100644 --- a/gymboard-app/package-lock.json +++ b/gymboard-app/package-lock.json @@ -11,6 +11,7 @@ "@quasar/cli": "^2.0.0", "@quasar/extras": "^1.0.0", "axios": "^0.21.1", + "moment": "^2.29.4", "pinia": "^2.0.11", "quasar": "^2.6.0", "vue": "^3.0.0", @@ -4356,6 +4357,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "engines": { + "node": "*" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -9419,6 +9428,11 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==" }, + "moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", diff --git a/gymboard-app/package.json b/gymboard-app/package.json index fc79d4f..9e31681 100644 --- a/gymboard-app/package.json +++ b/gymboard-app/package.json @@ -14,6 +14,7 @@ "@quasar/cli": "^2.0.0", "@quasar/extras": "^1.0.0", "axios": "^0.21.1", + "moment": "^2.29.4", "pinia": "^2.0.11", "quasar": "^2.6.0", "vue": "^3.0.0", diff --git a/gymboard-app/quasar.config.js b/gymboard-app/quasar.config.js index d6f5cd1..4b15218 100644 --- a/gymboard-app/quasar.config.js +++ b/gymboard-app/quasar.config.js @@ -55,7 +55,7 @@ module.exports = configure(function (ctx) { node: 'node16', }, - vueRouterMode: 'hash', // available values: 'hash', 'history' + vueRouterMode: 'history', // available values: 'hash', 'history' // vueRouterBase, // vueDevtools, // vueOptionsAPI: false, diff --git a/gymboard-app/src/api/main/submission.ts b/gymboard-app/src/api/main/submission.ts index 3d563a3..90cd975 100644 --- a/gymboard-app/src/api/main/submission.ts +++ b/gymboard-app/src/api/main/submission.ts @@ -16,6 +16,18 @@ export interface ExerciseSubmissionPayload { videoFileId: string; } +export enum WeightUnit { + KILOGRAMS = 'KILOGRAMS', + POUNDS = 'POUNDS' +} + +export class WeightUnitUtil { + public static toAbbreviation(unit: WeightUnit): string { + if (unit === WeightUnit.POUNDS) return 'Lbs'; + return 'Kg'; + } +} + export interface ExerciseSubmission { id: string; createdAt: string; @@ -24,7 +36,7 @@ export interface ExerciseSubmission { videoFileId: string; submitterName: string; rawWeight: number; - weightUnit: string; + weightUnit: WeightUnit; metricWeight: number; reps: number; } diff --git a/gymboard-app/src/pages/SubmissionPage.vue b/gymboard-app/src/pages/SubmissionPage.vue new file mode 100644 index 0000000..3cf39ff --- /dev/null +++ b/gymboard-app/src/pages/SubmissionPage.vue @@ -0,0 +1,29 @@ + + + \ No newline at end of file diff --git a/gymboard-app/src/router/routes.ts b/gymboard-app/src/router/routes.ts index b607dfc..611732a 100644 --- a/gymboard-app/src/router/routes.ts +++ b/gymboard-app/src/router/routes.ts @@ -11,6 +11,7 @@ import LoginPage from 'pages/auth/LoginPage.vue'; import RegisterPage from 'pages/auth/RegisterPage.vue'; import RegistrationSuccessPage from 'pages/auth/RegistrationSuccessPage.vue'; import ActivationPage from 'pages/auth/ActivationPage.vue'; +import SubmissionPage from 'pages/SubmissionPage.vue'; const routes: RouteRecordRaw[] = [ // Auth-related pages, which live outside the main layout. @@ -35,6 +36,7 @@ const routes: RouteRecordRaw[] = [ { path: 'leaderboard', component: GymLeaderboardsPage }, ], }, + { path: 'submissions/:submissionId', component: SubmissionPage }, { path: 'about', component: AboutPage }, ], }, diff --git a/gymboard-cdn/src/main/java/nl/andrewlalis/gymboardcdn/GymboardCdnApplication.java b/gymboard-cdn/src/main/java/nl/andrewlalis/gymboardcdn/GymboardCdnApplication.java index 04649d3..e91e89d 100644 --- a/gymboard-cdn/src/main/java/nl/andrewlalis/gymboardcdn/GymboardCdnApplication.java +++ b/gymboard-cdn/src/main/java/nl/andrewlalis/gymboardcdn/GymboardCdnApplication.java @@ -3,10 +3,13 @@ package nl.andrewlalis.gymboardcdn; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import java.util.TimeZone; + @SpringBootApplication public class GymboardCdnApplication { public static void main(String[] args) { + TimeZone.setDefault(TimeZone.getTimeZone("UTC")); SpringApplication.run(GymboardCdnApplication.class, args); } diff --git a/gymboard-search/src/main/java/nl/andrewlalis/gymboardsearch/GymboardSearchApplication.java b/gymboard-search/src/main/java/nl/andrewlalis/gymboardsearch/GymboardSearchApplication.java index 0e7f79d..4033346 100644 --- a/gymboard-search/src/main/java/nl/andrewlalis/gymboardsearch/GymboardSearchApplication.java +++ b/gymboard-search/src/main/java/nl/andrewlalis/gymboardsearch/GymboardSearchApplication.java @@ -5,6 +5,8 @@ import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import java.util.TimeZone; + @SpringBootApplication public class GymboardSearchApplication implements CommandLineRunner { private final GymIndexGenerator gymIndexGenerator; @@ -14,6 +16,7 @@ public class GymboardSearchApplication implements CommandLineRunner { } public static void main(String[] args) { + TimeZone.setDefault(TimeZone.getTimeZone("UTC")); SpringApplication.run(GymboardSearchApplication.class, args); } diff --git a/runner.d b/runner.d new file mode 100644 index 0000000..e7e60a8 --- /dev/null +++ b/runner.d @@ -0,0 +1,22 @@ +#!/usr/bin/env rdmd + +/** + * TODO: This module will eventually serve as some sort of setup script for + * if/when it becomes too complicated to just start the services. It should + * run as a CLI thing for entering commands to start/stop things. + */ +module runner; + +import std.process; +import std.stdio; +import std.string; +import std.uni; + +alias CommandFunction = void function(string[] args); + +int main() { + while (true) { + string[] command = readln().split!isWhite; + + } +} \ No newline at end of file