Procházet zdrojové kódy

:bug: fixing bad schema import

tags/0.0.1^2
J před 3 roky
rodič
revize
b431fd5ec7

+ 3
- 2
backend/lib/schemas/profiles.js Zobrazit soubor

@@ -3,6 +3,7 @@
3 3
 const Joi = require('joi')
4 4
 const surveyResponseSchema = require('./responses')
5 5
 const userSchema = require('./user')
6
+const tagSchema = require('./tags')
6 7
 
7 8
 const singleProfile = Joi.object({
8 9
     profile_id: Joi.number(),
@@ -11,7 +12,7 @@ const singleProfile = Joi.object({
11 12
     user_email: Joi.string(),
12 13
     responses: surveyResponseSchema.list,
13 14
     reveal: Joi.array().items(),
14
-    tags: Joi.array().items(),
15
+    tags: tagSchema.list,
15 16
     user_type: Joi.any(),
16 17
     user: userSchema.single,
17 18
     profile_description: Joi.string().allow(null, ''),
@@ -22,5 +23,5 @@ const singleProfile = Joi.object({
22 23
 
23 24
 module.exports = {
24 25
     single: singleProfile,
25
-    list: Joi.array().items(singleProfile).label('profile_list')
26
+    list: Joi.array().items(singleProfile).label('profile_list'),
26 27
 }

+ 24
- 0
backend/lib/schemas/tags.js Zobrazit soubor

@@ -0,0 +1,24 @@
1
+'use strict'
2
+
3
+const Joi = require('joi')
4
+
5
+const singleTag = Joi.object({
6
+    tag_id: Joi.number(),
7
+    tag_category: Joi.string(),
8
+    tag_description: Joi.string(),
9
+    is_active: Joi.number().required(),
10
+}).label('tag_single')
11
+
12
+const singleTagAssociation = Joi.object({
13
+    tag_association_id: Joi.number(),
14
+    profile_id: Joi.number().required(),
15
+    membership_id: Joi.number(),
16
+    tag_id: Joi.number().required(),
17
+    is_deleted: Joi.boolean().required(),
18
+}).label('tag_association_single')
19
+
20
+module.exports = {
21
+    association: singleTagAssociation,
22
+    single: singleTag,
23
+    list: Joi.array().items(singleTag).label('tag_list'),
24
+}

+ 0
- 1
frontend/src/components/MainNav.vue Zobrazit soubor

@@ -1,6 +1,5 @@
1 1
 <template lang="pug">
2 2
 nav#main-header
3
-    button(@click="$emit('show-sidebar')") toggle sidebar
4 3
     router-link(:to="`/matches`") matches
5 4
     router-link(to='/') home
6 5
     router-link(:to="`/survey`") survey

+ 6
- 0
frontend/src/router/index.js Zobrazit soubor

@@ -2,6 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router'
2 2
 
3 3
 import HomeView from '../views/HomeView.vue'
4 4
 import ProfileView from '../views/ProfileView.vue'
5
+import ChatView from '../views/ChatView.vue'
5 6
 import MatchesView from '../views/MatchesView.vue'
6 7
 import LoginView from '../views/LoginView.vue'
7 8
 import SurveyView from '../views/SurveyView.vue'
@@ -30,6 +31,11 @@ const routes = [
30 31
         component: ProfileView,
31 32
         meta: { requiresAuth: true, requiresCompleteProfile: true },
32 33
     },
34
+    {
35
+        path: '/chat/:tid',
36
+        component: ChatView,
37
+        meta: { requiresAuth: true, requiresCompleteProfile: true },
38
+    },
33 39
     {
34 40
         path: `/survey`,
35 41
         component: SurveyView,

+ 42
- 0
frontend/src/views/ChatView.vue Zobrazit soubor

@@ -0,0 +1,42 @@
1
+<template lang="pug">
2
+main.view--chat.f-col.start.w-full
3
+    header 
4
+        h2 Chat Page
5
+ 
6
+    article(v-if="!loading")
7
+        h3 {{ profile.id }} 
8
+            span chatting with: {{ target.profile_id }}
9
+        p subscriptions: {{ profile.chatter.subscriptions }}
10
+    p(v-else) Loading...
11
+
12
+    MainNav(@show-sidebar="$emit('show-sidebar')")
13
+</template>
14
+
15
+<script>
16
+import { fetchProfileByProfileId, currentProfile } from '../services'
17
+
18
+export default {
19
+    name: 'ProfileView',
20
+    data: () => ({
21
+        loading: true,
22
+        target: {},
23
+        profile: currentProfile,
24
+    }),
25
+    created() {
26
+        this.getProfile()
27
+    },
28
+    methods: {
29
+        async getProfile() {
30
+            this.loading = true
31
+            try {
32
+                this.target = await fetchProfileByProfileId(
33
+                    this.$route.params.tid,
34
+                )
35
+            } catch (err) {
36
+                console.error(err)
37
+            }
38
+            this.loading = false
39
+        },
40
+    },
41
+}
42
+</script>

Načítá se…
Zrušit
Uložit