Commit a08bdb4 1 parent 7b900ab commit a08bdb4 Copy full SHA for a08bdb4
File tree 6 files changed +25
-3
lines changed
6 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -41,4 +41,4 @@ coverage
41
41
42
42
/target
43
43
/Cargo.lock
44
- /apps /web /build.zip
44
+ /apps /web /build.zip
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ DATABASE_PORT=5432
12
12
DATABASE_NAME = ' databaseName'
13
13
DATABASE_USERNAME = ' user'
14
14
DATABASE_PASSWORD = ' password'
15
- ENCRYPT_KEY = ' MySuperPassword!MySuperPassword!'
16
15
17
16
POSTGRES_USER = postgres
18
17
POSTGRES_PW = postgres
Original file line number Diff line number Diff line change 1
1
import { API_ERRORS , ApiError } from '@api'
2
- import type { DiaryUserId , Nullable } from '@diary-spo/shared'
2
+ import type { Nullable } from '@diary-spo/shared'
3
+ import { formatDate } from '@utils'
3
4
import { caching } from 'cache-manager'
5
+ import { authSaveUseDate } from 'src/models/Auth/actions/save'
4
6
import { AuthModel , type AuthModelType } from '../models/Auth'
5
7
import { DiaryUserModel , type DiaryUserModelType } from '../models/DiaryUser'
6
8
import { GroupModel , type GroupModelType } from '../models/Group'
@@ -75,6 +77,9 @@ export const getCookieFromToken = async (
75
77
throw new ApiError ( API_ERRORS . INVALID_TOKEN , 401 )
76
78
}
77
79
80
+ if ( diaryUserAuth . lastUsedDate !== formatDate ( new Date ( ) ) )
81
+ authSaveUseDate ( token , new Date ( ) )
82
+
78
83
const user = diaryUserAuth . diaryUser
79
84
const spoId = user . group . spo . id
80
85
Original file line number Diff line number Diff line change
1
+ import { formatDate } from '@utils'
2
+ import { AuthModel , IAuthModel } from '../../model'
3
+
4
+ export const authSaveUseDate = async (
5
+ token : string ,
6
+ date : Date
7
+ ) : Promise < [ affectedCount : number ] > =>
8
+ AuthModel . update (
9
+ {
10
+ lastUsedDate : formatDate ( date )
11
+ } ,
12
+ {
13
+ where : {
14
+ token
15
+ }
16
+ }
17
+ )
Original file line number Diff line number Diff line change
1
+ export * from './authSaveUseDate'
You can’t perform that action at this time.
0 commit comments