Sign inSign up

kalmonipa/howarethey

By kalmonipa

•Updated about 2 years ago

A reminder system to keep in touch with your friends https://github.com/Kalmonipa/HowAreThey

Image
Web servers
0

979

kalmonipa/howarethey repository overview

⁠HowAreThey

A reminder system to keep in touch with your friends. It's a simple tool to prompt you to get in touch with people that you might lose touch with over time.

If you define a notification service and pass in a webhook URL, it will send a message to your channel/device. Currently it only supports Discord and Ntfy. The message will look something like

HowAreThey
You should get in touch with Jack Reacher. You haven't spoken to them since 06/06/2023.

Currently, this is just intended as a backend web server with a few endpoints, storing the data in a SQLite database. Updating the info is a bit finnicky if you're not used to using CLI/Curl/etc.

I'm also working on a frontend web page for this but Javascript is hard and don't currently have the time to learn it at the moment.

⁠Usage
⁠To run the container

Replace the tag with the tag you want to use

docker run -p 8080:8080 -v $PWD/sql/:/home/hat/sql/ kalmonipa/howarethey:v0.16

See docker-compose.yaml for an example Docker Compose file.

⁠Examples

Here is a JSON object of an example person:

{
  "ID": "1",
  "Name": "Steve Carell",
  "LastContacted": "2023-06-06",
  "Birthday": "1962-08-16",
  "Notes": "Ask him how his store is going in Marshfield"
}

To update the notes for example, you can send a request using the /friends/:id endpoint. Only the keys that are provided will get updated.

curl "http://localhost:8080/friends/1" \
    --request PUT \
    --header "Content-Type: application/json" \
    --data "{\"Notes\":\"His store is going great\"}"

To update both the Notes and the LastContacted field, you would send something like this

curl "http://localhost:8080/friends/1" \
        --request PUT \
        --header "Content-Type: application/json" \
        --data "{\"LastContacted\":\"2024-04-17\",\"Notes\":\"His store is going great\"}"

Calling GET /friends/random will trigger a random friend to get chosen, their LastContacted field to get updated to today and a notification will get sent to your notification service specified in the env var (if any is set)

⁠Endpoints available
EndpointDescription
GET /friendsReturns a list of all the friends in the database.
GET /birthdaysReturns a list of all the friends that have birthdays today
GET /friends/countReturns the number of friends in the list
GET /friends/id/:idReturns the object with the ID specified
GET /friends/name/:nameReturns the object with the name specified
GET /friends/randomPicks a random friend from the database and returns their details
DELETE /friends/:idDeletes the friend that matches the ID specified from the database.
POST /friendsAdds the friend using the Name, LastContacted, Birthday and Notes data specified in the request.
PUT /friends/:idUpdates the friend that relates to :id specified with the new data specified in the request.
⁠Docker Config
Environment VariableDetailsExampleDefault
NOTIFICATION_SERVICEUsed to define which service to use for notifications. Can be one of DISCORD, NTFYDISCORDN/A
WEBHOOK_URLProvide a Discord webhook to send notifications to Discord. Not providing a webhook will only log the events, it won't send the notification anywhereN/AN/A
FRIEND_SELECTOR_CRON_SCHEDULECron expression⁠ to define how often a friend will get picked. By default, runs at 7am every Monday (whatever timezone your machine is in). Use integer format for each field.0 18 * * 40 7 * * 1
BIRTHDAY_CHECK_TIMEWhat time of day the app should check for birthdays. Must be within 0-23; 0 being midnight-1am, 23 being 11pm-midnight"8"8
IGNORE_BIRTHDAYSSet to true if you don't want the app to check for birthdaystruefalse
⁠Development

Write any new tests and run the following commands from the root directory

⁠Unit tests

go test -v ./pkg/test/unit_test

⁠Integration tests

./run-integration-tests.sh

To skip the image build step (if you already have an image for your feature branch on your local machine), set the BUILD_IMAGE env var to false and run the int test script. i.e: BUILD_IMAGE="false" ./run-integration-tests.sh

If the tests pass submit a Pull Request with a detailed description.

Tag summary

Content type

Image

Digest

sha256:9d038a6cc…

Size

4.9 MB

Last updated

almost 3 years ago

docker pull kalmonipa/howarethey