ソースを参照

:recycle: stub some test stuff

undefined
j 2年前
コミット
dfef2dc72f

+ 9
- 0
backend/lib/plugins/profile.js ファイルの表示

@@ -1,6 +1,9 @@
1 1
 const Objection = require('objection')
2 2
 const Schmervice = require('@hapipal/schmervice')
3 3
 
4
+const Jwt = require('hapi-auth-jwt2')
5
+const JwtStrategy = require('../auth/strategies/jwt')
6
+
4 7
 const ProfileModel = require('../models/profile')
5 8
 const TagModel = require('../models/tag')
6 9
 const TagAssociationModel = require('../models/tag-association')
@@ -29,6 +32,7 @@ module.exports = {
29 32
     name: 'profile-plugin',
30 33
     version: '1.0.0',
31 34
     register: async (server, options) => {
35
+        await server.register(Jwt)
32 36
         await server.registerModel(ProfileModel)
33 37
         await server.registerModel(TagModel)
34 38
         await server.registerModel(TagAssociationModel)
@@ -38,6 +42,11 @@ module.exports = {
38 42
         await server.registerModel(ZipCodeModel)
39 43
         await server.registerModel(MatchQueueModel)
40 44
 
45
+        const mainApp = server.registrations['main-app-plugin']
46
+        const jwtOptions = JwtStrategy(mainApp.options)
47
+        server.auth.strategy('default_jwt', 'jwt', jwtOptions)
48
+        server.auth.default('default_jwt')
49
+
41 50
         // Bind to global context
42 51
         // So we can use Objection transactions
43 52
         server.bind({

+ 7
- 3
backend/package-lock.json ファイルの表示

@@ -1926,9 +1926,9 @@
1926 1926
             }
1927 1927
         },
1928 1928
         "node_modules/caniuse-lite": {
1929
-            "version": "1.0.30001423",
1930
-            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001423.tgz",
1931
-            "integrity": "sha512-09iwWGOlifvE1XuHokFMP7eR38a0JnajoyL3/i87c8ZjRWRrdKo1fqjNfugfBD0UDBIOz0U+jtNhJ0EPm1VleQ==",
1929
+            "version": "1.0.30001565",
1930
+            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001565.tgz",
1931
+            "integrity": "sha512-xrE//a3O7TP0vaJ8ikzkD2c2NgcVUvsEe2IvFTntV4Yd1Z9FVzh+gW+enX96L0psrbaFMcVcH2l90xNuGDWc8w==",
1932 1932
             "dev": true,
1933 1933
             "funding": [
1934 1934
                 {
@@ -1938,6 +1938,10 @@
1938 1938
                 {
1939 1939
                     "type": "tidelift",
1940 1940
                     "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
1941
+                },
1942
+                {
1943
+                    "type": "github",
1944
+                    "url": "https://github.com/sponsors/ai"
1941 1945
                 }
1942 1946
             ]
1943 1947
         },

+ 5
- 0
backend/tests/matchqueue.spec.js ファイルの表示

@@ -60,6 +60,11 @@ test('path /<profile_id>/queue/<target_id> should return ok on PATCH', async t =
60 60
      */
61 61
     server.registerModel = () => {}
62 62
     server.models = () => ({ Aspect, AspectLabel, MatchQueue, Profile })
63
+    server.registrations = {
64
+        'main-app-plugin': {
65
+            options: {},
66
+        },
67
+    }
63 68
     /**
64 69
      * Register Routes and Services as usual
65 70
      */

+ 5
- 0
backend/tests/profile.spec.js ファイルの表示

@@ -49,6 +49,11 @@ test('path /<profile_id> should return ok', async t => {
49 49
      */
50 50
     server.registerModel = () => {}
51 51
     server.models = () => ({ Profile, Tag })
52
+    server.registrations = {
53
+        'main-app-plugin': {
54
+            options: {},
55
+        },
56
+    }
52 57
     /**
53 58
      * Register Routes and Services as usual
54 59
      */

+ 5
- 0
backend/tests/respond.spec.js ファイルの表示

@@ -52,6 +52,11 @@ test('path /<profile_id>/respond should return ok on POST', async t => {
52 52
      */
53 53
     server.registerModel = () => {}
54 54
     server.models = () => ({ Response, ResponseKey })
55
+    server.registrations = {
56
+        'main-app-plugin': {
57
+            options: {},
58
+        },
59
+    }
55 60
     /**
56 61
      * Register Routes and Services as usual
57 62
      */

+ 5
- 0
backend/tests/score.spec.js ファイルの表示

@@ -93,6 +93,11 @@ test(`path ${pathToTest.url} should return ok on GET`, async t => {
93 93
         Profile,
94 94
         ZipCode,
95 95
     })
96
+    server.registrations = {
97
+        'main-app-plugin': {
98
+            options: {},
99
+        },
100
+    }
96 101
     /**
97 102
      * Register Routes and Services as usual
98 103
      */

+ 5
- 0
backend/tests/update.spec.js ファイルの表示

@@ -66,6 +66,11 @@ test(`path ${pathToTest.url} should return ok on ${pathToTest.method}`, async t
66 66
      */
67 67
     server.registerModel = () => {}
68 68
     server.models = () => ({ Response, ResponseKey })
69
+    server.registrations = {
70
+        'main-app-plugin': {
71
+            options: {},
72
+        },
73
+    }
69 74
     /**
70 75
      * Register Routes and Services as usual
71 76
      */

+ 2
- 2
frontend/src/utils/db.js ファイルの表示

@@ -1,5 +1,5 @@
1
-const domain = import.meta.env.VITE_API_HOST
2
-const port = import.meta.env.VITE_API_PORT
1
+const domain = import.meta.env ? import.meta.env.VITE_API_HOST : 'localhost'
2
+const port = import.meta.env ? import.meta.env.VITE_API_PORT : 3000
3 3
 const httpProtocol = `http`
4 4
 const prefix = 'api'
5 5
 const remote = `${httpProtocol}://${domain}:${port}/${prefix}`

読み込み中…
キャンセル
保存