File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 1
- const db = require ( '../../db' ) ;
1
+ import { authorise , reject } from '../../db' ;
2
+ import { Action } from './Action' ;
2
3
3
- const attemptAutoApproval = async ( action ) => {
4
+ const attemptAutoApproval = async ( action : Action ) => {
4
5
try {
5
6
const attestation = {
6
7
timestamp : new Date ( ) ,
7
8
autoApproved : true ,
8
9
} ;
9
- await db . authorise ( action . id , attestation ) ;
10
+ await authorise ( action . id , attestation ) ;
10
11
console . log ( 'Push automatically approved by system.' ) ;
11
12
12
13
return true ;
13
- } catch ( error ) {
14
+ } catch ( error : any ) {
14
15
console . error ( 'Error during auto-approval:' , error . message ) ;
15
16
return false ;
16
17
}
17
18
} ;
18
19
19
- const attemptAutoRejection = async ( action ) => {
20
+ const attemptAutoRejection = async ( action : Action ) => {
20
21
try {
21
22
const attestation = {
22
23
timestamp : new Date ( ) ,
23
24
autoApproved : true ,
24
25
} ;
25
- await db . reject ( action . id , attestation ) ;
26
+ await reject ( action . id , attestation ) ;
26
27
console . log ( 'Push automatically rejected by system.' ) ;
27
28
28
29
return true ;
29
- } catch ( error ) {
30
+ } catch ( error : any ) {
30
31
console . error ( 'Error during auto-rejection:' , error . message ) ;
31
32
return false ;
32
33
}
33
34
} ;
34
35
35
- module . exports = {
36
+ export {
36
37
attemptAutoApproval ,
37
38
attemptAutoRejection ,
38
39
} ;
You can’t perform that action at this time.
0 commit comments