Skip to content

Commit

Permalink
@document needed on implementing records - not on Card (#71)
Browse files Browse the repository at this point in the history
replace Test page by RegistrationPage.vue
  • Loading branch information
wisskirchenj authored Feb 12, 2024
1 parent a3b6b80 commit 58d9211
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 140 deletions.
57 changes: 0 additions & 57 deletions frontend/src/feature/category/pages/CategoryOverviewPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,63 +23,6 @@ const items = ref([] as
{ category: Category, expanded: boolean }[]
);
// ------------------- TEST DATA -------------------
// ---uncomment if on npm run mode - and comment out the fetchCategories() call
// items.value.push({category: {id: "123", name: "test", description: "test", numberOfCards: 1, actions:
// [
// {
// "action": ActionType.WRITE,
// "uri": "http://localhost:8080/categories/123"
// },
// {
// "action": ActionType.DELETE,
// "uri": "http://localhost:8080/categories/123"
// }
// ]
// }, expanded: false});
//
// items.value.push({category: {id: "1234", name: "test2", description: "test description", numberOfCards: 2, actions:
// [
// {
// "action": ActionType.READ,
// "uri": "http://localhost:8080/categories/123"
// },
// {
// "action": ActionType.DELETE,
// "uri": "http://localhost:8080/categories/123"
// }
// ]
// }, expanded: false});
//
// items.value.push({category: {id: "12345", name: "test3", description: "test with blah", numberOfCards: 3, actions:
// [
// {
// "action": ActionType.WRITE,
// "uri": "http://localhost:8080/categories/123"
// },
// {
// "action": ActionType.READ,
// "uri": "http://localhost:8080/categories/123"
// }
// ]
// }, expanded: false});
// items.value.push({category: {id: "123456", name: "test-last", description: "test", numberOfCards: 2, actions:
// [
// {
// "action": ActionType.READ,
// "uri": "http://localhost:8080/categories/123"
// },
// {
// "action": ActionType.WRITE,
// "uri": "http://localhost:8080/categories/123"
// },
// {
// "action": ActionType.DELETE,
// "uri": "http://localhost:8080/categories/123"
// }
// ]
// }, expanded: false});
const fetchCategories = async () => {
items.value = [];
const categories = await useCategoriesService().getCategories();
Expand Down
37 changes: 37 additions & 0 deletions frontend/src/feature/registration/pages/RegistrationPage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<template>
<v-container>
<v-card class="pa-2 ma-2 mx-auto d-flex flex-column justify-space-between"
fill-height
color="containerBackground">
<v-card-title class="text-center text-h4">
User Registration
</v-card-title>
<v-container>
<v-row>
<v-col cols="12" sm="6" md="4"/>
<v-col cols="12" sm="6" md="4" class="align-content-center">
<v-text-field v-model="email" label="Email"/>
<v-text-field v-model="password" label="Password" type="password"/>
<v-btn color="black" border @click="postNewUser" variant="text">
Register new user
</v-btn>
</v-col>
</v-row>
</v-container>
</v-card>
</v-container>
</template>

<script setup lang="ts">
import useCardsService from "@/feature/cards/composables/useCardsService";
import {ref} from "vue";
const email = ref('');
const password = ref('');
const postNewUser = () => {
useCardsService().postNewUser(email.value, password.value);
}
</script>

<style scoped lang="scss"/>
2 changes: 1 addition & 1 deletion frontend/src/layouts/SideNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<v-list-item title="Flashcards" subtitle="Menu"></v-list-item>
<v-divider></v-divider>
<v-list-item to="/categories" title="Your card categories"></v-list-item>
<v-list-item to="/test" title="Test axios"></v-list-item>
<v-list-item to="/register" title="User registration"></v-list-item>
<v-divider></v-divider>
<v-list-item to="/" title="Welcome"></v-list-item>
</v-navigation-drawer>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const routes = [
props: true,
},
{
path: '/test',
path: '/register',
name: 'axios-line-temp',
component: () => import("@/shared/_temptestutils/AxiosLineTemp.vue"),
component: () => import("@/feature/registration/pages/RegistrationPage.vue"),
},
// Always leave this as last one,
// but you can also remove it
Expand Down
78 changes: 0 additions & 78 deletions frontend/src/shared/_temptestutils/AxiosLineTemp.vue

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.springframework.data.mongodb.core.mapping.Document;

import java.time.Instant;
import java.util.Set;
Expand All @@ -11,7 +10,6 @@
* Basic class for all flashcards, contains fields shared among all subclasses
*/

@Document
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
property = "type"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.springframework.data.annotation.PersistenceCreator;
import org.springframework.data.annotation.Transient;
import org.springframework.data.annotation.TypeAlias;
import org.springframework.data.mongodb.core.mapping.Document;

import java.time.Instant;
import java.util.List;
Expand All @@ -18,6 +19,7 @@
*/
@Builder
@TypeAlias("MCQ")
@Document
public record MultipleChoiceQuiz(
@Id String id,
String title,
Expand All @@ -32,6 +34,7 @@ public record MultipleChoiceQuiz(
public MultipleChoiceQuiz setPermissions(String permissions) {
return new MultipleChoiceQuiz(id, title, tags, question, createdAt, permissions, options, correctOptions);
}

@PersistenceCreator
@SuppressWarnings("unused")
public MultipleChoiceQuiz(String id, String title, Set<String> tags, String question, List<String> options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import org.springframework.data.annotation.PersistenceCreator;
import org.springframework.data.annotation.Transient;
import org.springframework.data.annotation.TypeAlias;
import org.springframework.data.mongodb.core.mapping.Document;

import java.time.Instant;
import java.util.Set;

@Builder
@TypeAlias("QNA")
@Document
public record QuestionAndAnswer(
@Id String id,
String title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.springframework.data.annotation.PersistenceCreator;
import org.springframework.data.annotation.Transient;
import org.springframework.data.annotation.TypeAlias;
import org.springframework.data.mongodb.core.mapping.Document;

import java.time.Instant;
import java.util.List;
Expand All @@ -18,6 +19,7 @@
*/
@Builder
@TypeAlias("SCQ")
@Document
public record SingleChoiceQuiz(
@Id String id,
String title,
Expand Down

0 comments on commit 58d9211

Please sign in to comment.