File tree Expand file tree Collapse file tree 6 files changed +23
-2
lines changed Expand file tree Collapse file tree 6 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -42,3 +42,4 @@ coverage
42
42
/target
43
43
/Cargo.lock
44
44
/apps /web /build.zip
45
+ bun.lockb
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
3
import { caching } from 'cache-manager'
4
4
import { AuthModel , type AuthModelType } from '../models/Auth'
5
5
import { DiaryUserModel , type DiaryUserModelType } from '../models/DiaryUser'
6
6
import { GroupModel , type GroupModelType } from '../models/Group'
7
7
import { SPOModel , type SPOModelType } from '../models/SPO'
8
+ import { formatDate } from '@utils'
9
+ import { authSaveUseDate } from 'src/models/Auth/actions/save'
8
10
9
11
const memoryCache = await caching ( 'memory' , {
10
12
max : 1000 ,
@@ -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
+ lastUsedDate : formatDate ( date )
10
+ } ,
11
+ {
12
+ where : {
13
+ token
14
+ }
15
+ } )
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