File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ module.exports = {
5
5
name : 'Igor Halfeld' ,
6
6
7
7
password : '1234' ,
8
- apiKey : 'fcd5015c-10d3-4e9c-b395-ec7ed8850165' ,
8
+ apiKey : [ 'fcd5015c-10d3-4e9c-b395-ec7ed8850165' ] ,
9
9
createdAt : new Date ( '2020-09-05' ) . getTime ( )
10
10
}
11
11
] ,
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ function CreateFeedbackHandler (db) {
84
84
}
85
85
86
86
feedbacks = feedbacks . filter ( ( feedback ) => {
87
- return feedback . apiKey === user . apiKey
87
+ return user . apiKey . includes ( feedback . apiKey )
88
88
} )
89
89
90
90
if ( type ) {
@@ -128,7 +128,7 @@ function CreateFeedbackHandler (db) {
128
128
}
129
129
130
130
feedbacks = feedbacks . filter ( ( feedback ) => {
131
- return feedback . apiKey === user . apiKey
131
+ return user . apiKey . includes ( feedback . apiKey )
132
132
} )
133
133
134
134
if ( type ) {
Original file line number Diff line number Diff line change @@ -21,7 +21,10 @@ function CreateUserHandler (db) {
21
21
const apiKey = uuidv4 ( )
22
22
const { id } = ctx . state . user
23
23
24
- const updated = await db . update ( 'users' , id , { apiKey } )
24
+ const user = await db . readOneById ( 'users' , id )
25
+ const updated = await db . update ( 'users' , id , {
26
+ apiKey : [ ...user . apikey , apiKey ]
27
+ } )
25
28
if ( updated ) {
26
29
ctx . status = 202
27
30
ctx . body = { apiKey }
@@ -55,7 +58,7 @@ function CreateUserHandler (db) {
55
58
name,
56
59
email,
57
60
password,
58
- apikey : uuidv4 ( ) ,
61
+ apikey : [ uuidv4 ( ) ] ,
59
62
createdAt : new Date ( ) . getTime ( )
60
63
}
61
64
You can’t perform that action at this time.
0 commit comments