-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added remaining cli actions * Fix bug with search job and create proposal * upload to attachments bucket --------- Co-authored-by: shimaabetah <shimaabetah1911@gmail.com>
- Loading branch information
1 parent
00cbad8
commit 3834089
Showing
11 changed files
with
229 additions
and
2 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
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,17 @@ | ||
#!/bin/bash | ||
|
||
YELLOW='\033[0;33m' | ||
NC='\033[0m' | ||
|
||
#reading the array from the json attachments response | ||
readarray -t attachments < <(echo $1 | jq -c '.[]') | ||
|
||
mkdir -p "./media/proposal"$2"_attachments" | ||
|
||
for attachment in ${attachments[@]}; do | ||
|
||
url=$(echo "$attachment" | jq -r '.url') | ||
curl --request GET \ | ||
--url http://localhost:8080"$url" \ | ||
--output "./media/proposal"$2"_attachments/$2.pdf" | ||
done |
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,42 @@ | ||
#!/bin/bash | ||
|
||
YELLOW='\033[0;33m' | ||
NC='\033[0m' | ||
|
||
read -p "job id: " jobId | ||
read -p "cover letter: " coverLetter | ||
|
||
echo "what is the proposed duration" | ||
DURATIONS=("LESS_THAN_A_MONTH" "ONE_TO_THREE_MONTHS" "THREE_TO_SIX_MONTHS" "MORE_THAN_SIX_MONTHS") | ||
jobDuration=$(bash ./commands/dropdown.sh ${DURATIONS[@]}) | ||
|
||
#attachements list | ||
attachments=$(bash ./entities/attachment/attachment_list.sh) | ||
|
||
#milestones list | ||
milestones=$(bash ./entities/milestone/milestone_list.sh) | ||
|
||
json_payload=$(cat <<EOF | ||
{ | ||
"coverLetter": "$coverLetter", | ||
"jobId": "$jobId", | ||
"jobDuration": "$jobDuration", | ||
"attachments": $attachments, | ||
"milestones": $milestones | ||
} | ||
EOF | ||
) | ||
|
||
echo "$json_payload" | ||
|
||
echo -e "${YELLOW}Sending your request to the server...${NC}" | ||
|
||
bearerToken=$(cat ./token.txt) | ||
|
||
status_code=$(curl -s -o response_body -w "%{http_code}" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $bearerToken" -d "$json_payload" http://localhost:80/api/v1/jobs/{$jobId}/proposals) | ||
|
||
response_body=$(cat response_body) | ||
|
||
rm response_body | ||
|
||
bash ./response_formatter.sh "$status_code" "$response_body" |
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
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
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,41 @@ | ||
#!/bin/bash | ||
|
||
YELLOW='\033[0;33m' | ||
NC='\033[0m' | ||
|
||
pageState="null" | ||
read -p "query: " query | ||
read -p "pageLimit: " pageLimit | ||
|
||
while true; do | ||
|
||
|
||
|
||
base_url="http://localhost:80/api/v1/jobs/search" | ||
|
||
url="${base_url}?query="$query"&pageLimit=${pageLimit}" | ||
|
||
if [[ "$pageState" != "null" ]]; then | ||
url="${base_url}?query="$query"&pageLimit=${pageLimit}&pagingState="$pageState"" | ||
fi | ||
|
||
echo -e "${YELLOW}Sending your request to the server...${NC}" | ||
|
||
bearerToken=$(cat ./token.txt) | ||
|
||
status_code=$(curl -s -o response_body -w "%{http_code}" -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $bearerToken" "$url") | ||
|
||
response_body=$(cat response_body) | ||
|
||
rm response_body | ||
|
||
bash ./response_formatter.sh "$status_code" "$response_body" | ||
|
||
pageState=$(echo $response_body | jq -r '.pagingState') | ||
|
||
read -p "enough or otherwise for next " breaker | ||
|
||
if [[ $breaker == "enough" ]]; then | ||
break | ||
fi | ||
done |
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,35 @@ | ||
#!/bin/bash | ||
|
||
source ./.env | ||
|
||
read -p "attachement name: " name | ||
|
||
if [[ "$name" == "done" ]]; then | ||
echo "done" | ||
exit 0 | ||
fi | ||
|
||
read -p "attachement path: " path | ||
|
||
bearerToken=$(cat ./token.txt) | ||
|
||
filename="${bearerToken}${name}" | ||
|
||
status_code=$(curl -o response_body --location 'http://localhost:8080/upload/attachments/' \ | ||
-u "$UPLOAD_USER:$UPLOAD_PASSWORD" \ | ||
--form "resource=@"$path"" \ | ||
--form "filename="$filename"") | ||
|
||
response_body=$(cat response_body) | ||
|
||
resumeLink=$(echo "$response_body" | jq -r '.path') | ||
|
||
json_payload=$(cat <<EOF | ||
{ | ||
"name": "$name", | ||
"url": "$resumeLink" | ||
} | ||
EOF | ||
) | ||
|
||
echo "$json_payload" |
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,20 @@ | ||
#!/bin/bash | ||
|
||
YELLOW='\033[0;33m' | ||
NC='\033[0m' | ||
|
||
inputs=() | ||
|
||
while true; do | ||
echo -e "${YELLOW}enter attachment or done${NC}" >&2 | ||
item=$(bash ./entities/attachment/attachment.sh) | ||
if [[ "$item" == "done" ]]; then | ||
break | ||
else | ||
inputs+=("$item") | ||
fi | ||
done | ||
|
||
json_output=$(printf "%s\n" "${inputs[@]}" | jq -s '.') | ||
|
||
echo "$json_output" |
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,22 @@ | ||
#!/bin/bash | ||
|
||
read -p "milestone description: " description | ||
|
||
if [[ "$description" == "done" ]]; then | ||
echo "done" | ||
exit 0 | ||
fi | ||
|
||
read -p "amount: " amount | ||
read -p "due date (YYYY-MM-DD): " dueDate | ||
|
||
json_payload=$(cat <<EOF | ||
{ | ||
"description": "$description", | ||
"amount": $amount, | ||
"dueDate": "$dueDate" | ||
} | ||
EOF | ||
) | ||
|
||
echo "$json_payload" |
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,20 @@ | ||
#!/bin/bash | ||
|
||
YELLOW='\033[0;33m' | ||
NC='\033[0m' | ||
|
||
inputs=() | ||
|
||
while true; do | ||
echo -e "${YELLOW}enter milestone or done${NC}" >&2 | ||
item=$(bash ./entities/milestone/milestone.sh) | ||
if [[ "$item" == "done" ]]; then | ||
break | ||
else | ||
inputs+=("$item") | ||
fi | ||
done | ||
|
||
json_output=$(printf "%s\n" "${inputs[@]}" | jq -s '.') | ||
|
||
echo "$json_output" |
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