-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93dc724
commit 17f29cf
Showing
3 changed files
with
216 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { input, select } from '@inquirer/prompts'; | ||
import { UserData } from '../../types/database'; | ||
import useSWR from 'swr'; | ||
import dbConnect from '../../middleware/database'; | ||
|
||
export const handleGetHacker = async () => { | ||
const hackerEmail = await input({ | ||
message: 'Enter hacker email', | ||
}); | ||
|
||
const subAction1 = await select({ | ||
message: 'Select an action to perform', | ||
choices: [ | ||
{ | ||
name: 'Get events', | ||
value: 'get-events', | ||
}, | ||
{ | ||
name: 'Get team info', | ||
value: 'get-team', | ||
}, | ||
{ | ||
name: 'Get application', | ||
value: 'get-application', | ||
}, | ||
{ | ||
name: 'Get document', | ||
value: 'get-document', | ||
}, | ||
], | ||
}); | ||
|
||
switch (subAction1) { | ||
case 'get-events': | ||
await getEvents(); | ||
break; | ||
case 'get-team': | ||
await getTeam(); | ||
break; | ||
case 'get-application': | ||
await getApplication(); | ||
break; | ||
case 'get-document': | ||
await getDocument(); | ||
break; | ||
default: | ||
console.log('Invalid action'); | ||
} | ||
}; | ||
|
||
const getEvents = async () => {}; | ||
|
||
const getTeam = async () => {}; | ||
|
||
const getApplication = async () => {}; | ||
|
||
const getDocument = async () => {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { input, select } from '@inquirer/prompts'; | ||
import dbConnect from '../../middleware/database'; | ||
|
||
// TODO: zi | ||
/** | ||
* Quickly change the application status of hacker. | ||
* A hacker has multiple application statuses. | ||
*/ | ||
export const handleModifyHacker = async () => { | ||
// get hacker email | ||
const hackerEmail = await input({ | ||
message: 'Enter hacker email', | ||
}); | ||
|
||
// get sub-action | ||
const subAction1 = await select({ | ||
message: 'Select sub-action to perform', | ||
choices: [ | ||
{ | ||
name: 'Change application status', | ||
value: 'change-status', | ||
}, | ||
{ | ||
name: 'Delete application', | ||
value: 'delete-application', | ||
}, | ||
{ | ||
name: 'Join a team', | ||
value: 'join-team', | ||
}, | ||
{ | ||
name: 'Leave team', | ||
value: 'leave-team', | ||
}, | ||
{ | ||
name: 'NFC check-in', | ||
value: 'nfc-check-in', | ||
}, | ||
], | ||
}); | ||
|
||
// perf | ||
switch (subAction1) { | ||
case 'change-status': | ||
break; | ||
case 'delete-application': | ||
break; | ||
case 'join-team': | ||
break; | ||
case 'leave-team': | ||
break; | ||
case 'nfc-check-in': | ||
break; | ||
} | ||
}; | ||
|
||
const changeStatus = async () => { | ||
const newStatus = await select({ | ||
message: 'Select new status', | ||
choices: [ | ||
{ | ||
name: 'Change application status to CREATED', | ||
value: 'created', | ||
}, | ||
{ | ||
name: 'Change application status to DECLINED', | ||
value: 'declined', | ||
}, | ||
{ | ||
name: 'Change application status to SUBMITTED', | ||
value: 'submitted', | ||
}, | ||
{ | ||
name: 'Change application status to ACCEPTED', | ||
value: 'accepted', | ||
}, | ||
{ | ||
name: 'Change application status to CONFIRMED', | ||
value: 'confirmed', | ||
}, | ||
{ | ||
name: 'Change application status to REJECTED', | ||
value: 'rejected', | ||
}, | ||
{ | ||
name: 'Change application status to CHECKED_IN', | ||
value: 'checked-in', | ||
}, | ||
], | ||
}); | ||
|
||
// | ||
await dbConnect(); | ||
}; | ||
|
||
const deleteApplication = async () => {}; | ||
|
||
const joinTeam = async () => {}; | ||
|
||
const leaveTeam = async () => {}; | ||
|
||
const nfcCheckIn = async () => {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters