Added submission page, momentjs, and UTC timezone for all services.

This commit is contained in:
Andrew Lalis 2023-02-05 11:30:50 +01:00
parent 64e604a946
commit 7c638d066e
10 changed files with 91 additions and 2 deletions

View File

@ -3,10 +3,13 @@ package nl.andrewlalis.gymboard_api;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.util.TimeZone;
@SpringBootApplication @SpringBootApplication
public class GymboardApiApplication { public class GymboardApiApplication {
public static void main(String[] args) { public static void main(String[] args) {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
SpringApplication.run(GymboardApiApplication.class, args); SpringApplication.run(GymboardApiApplication.class, args);
} }

View File

@ -11,6 +11,7 @@
"@quasar/cli": "^2.0.0", "@quasar/cli": "^2.0.0",
"@quasar/extras": "^1.0.0", "@quasar/extras": "^1.0.0",
"axios": "^0.21.1", "axios": "^0.21.1",
"moment": "^2.29.4",
"pinia": "^2.0.11", "pinia": "^2.0.11",
"quasar": "^2.6.0", "quasar": "^2.6.0",
"vue": "^3.0.0", "vue": "^3.0.0",
@ -4356,6 +4357,14 @@
"url": "https://github.com/sponsors/ljharb" "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": { "node_modules/ms": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "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", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==" "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": { "ms": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",

View File

@ -14,6 +14,7 @@
"@quasar/cli": "^2.0.0", "@quasar/cli": "^2.0.0",
"@quasar/extras": "^1.0.0", "@quasar/extras": "^1.0.0",
"axios": "^0.21.1", "axios": "^0.21.1",
"moment": "^2.29.4",
"pinia": "^2.0.11", "pinia": "^2.0.11",
"quasar": "^2.6.0", "quasar": "^2.6.0",
"vue": "^3.0.0", "vue": "^3.0.0",

View File

@ -55,7 +55,7 @@ module.exports = configure(function (ctx) {
node: 'node16', node: 'node16',
}, },
vueRouterMode: 'hash', // available values: 'hash', 'history' vueRouterMode: 'history', // available values: 'hash', 'history'
// vueRouterBase, // vueRouterBase,
// vueDevtools, // vueDevtools,
// vueOptionsAPI: false, // vueOptionsAPI: false,

View File

@ -16,6 +16,18 @@ export interface ExerciseSubmissionPayload {
videoFileId: string; 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 { export interface ExerciseSubmission {
id: string; id: string;
createdAt: string; createdAt: string;
@ -24,7 +36,7 @@ export interface ExerciseSubmission {
videoFileId: string; videoFileId: string;
submitterName: string; submitterName: string;
rawWeight: number; rawWeight: number;
weightUnit: string; weightUnit: WeightUnit;
metricWeight: number; metricWeight: number;
reps: number; reps: number;
} }

View File

@ -0,0 +1,29 @@
<template>
<q-page>
<standard-centered-page v-if="submission">
<h3>Submission: {{ submission.id }}</h3>
</standard-centered-page>
</q-page>
</template>
<script setup lang="ts">
import api from 'src/api/main';
import { ExerciseSubmission } from 'src/api/main/submission';
import { onMounted, ref, Ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
const submission: Ref<ExerciseSubmission | undefined> = ref();
const route = useRoute();
const router = useRouter();
onMounted(async () => {
const submissionId = route.params.submissionId as string;
try {
submission.value = await api.gyms.submissions.getSubmission(submissionId);
} catch (error) {
console.error(error);
await router.push('/');
}
});
</script>

View File

@ -11,6 +11,7 @@ import LoginPage from 'pages/auth/LoginPage.vue';
import RegisterPage from 'pages/auth/RegisterPage.vue'; import RegisterPage from 'pages/auth/RegisterPage.vue';
import RegistrationSuccessPage from 'pages/auth/RegistrationSuccessPage.vue'; import RegistrationSuccessPage from 'pages/auth/RegistrationSuccessPage.vue';
import ActivationPage from 'pages/auth/ActivationPage.vue'; import ActivationPage from 'pages/auth/ActivationPage.vue';
import SubmissionPage from 'pages/SubmissionPage.vue';
const routes: RouteRecordRaw[] = [ const routes: RouteRecordRaw[] = [
// Auth-related pages, which live outside the main layout. // Auth-related pages, which live outside the main layout.
@ -35,6 +36,7 @@ const routes: RouteRecordRaw[] = [
{ path: 'leaderboard', component: GymLeaderboardsPage }, { path: 'leaderboard', component: GymLeaderboardsPage },
], ],
}, },
{ path: 'submissions/:submissionId', component: SubmissionPage },
{ path: 'about', component: AboutPage }, { path: 'about', component: AboutPage },
], ],
}, },

View File

@ -3,10 +3,13 @@ package nl.andrewlalis.gymboardcdn;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.util.TimeZone;
@SpringBootApplication @SpringBootApplication
public class GymboardCdnApplication { public class GymboardCdnApplication {
public static void main(String[] args) { public static void main(String[] args) {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
SpringApplication.run(GymboardCdnApplication.class, args); SpringApplication.run(GymboardCdnApplication.class, args);
} }

View File

@ -5,6 +5,8 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.util.TimeZone;
@SpringBootApplication @SpringBootApplication
public class GymboardSearchApplication implements CommandLineRunner { public class GymboardSearchApplication implements CommandLineRunner {
private final GymIndexGenerator gymIndexGenerator; private final GymIndexGenerator gymIndexGenerator;
@ -14,6 +16,7 @@ public class GymboardSearchApplication implements CommandLineRunner {
} }
public static void main(String[] args) { public static void main(String[] args) {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
SpringApplication.run(GymboardSearchApplication.class, args); SpringApplication.run(GymboardSearchApplication.class, args);
} }

22
runner.d Normal file
View File

@ -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;
}
}