Categorygithub.com/AustinMusiku/Materix-go
module
0.0.0-20240919230250-84142b605b04
Repository: https://github.com/austinmusiku/materix-go.git
Documentation: pkg.go.dev

# README

Materix

Introduction

Inspiration

I came across this image and thought, "I could build that!"—so here we are. Project inspiration

Key Features

  • Find, add, manage and view friends on the app.
  • Share your free time with specific friends or make it visible to all your contacts.
  • Add tags to your free times for easy filtering.

Table of Contents

Installation

Prerequisites

Steps

  1. Clone the repo:

    git clone https://github.com/AustinMusiku/Materix-go.git
    cd Materix-go
    
  2. Install dependencies:

    go mod download
    
  3. Create an .envrc file and configure it with your environment vars shown in .envrc.example

  4. Run the database migrations:

    migrate -path ./db/migrations -database <DATABASE_URL> up
    
  5. Build the api:

    go build -o ./bin/api ./cmd/api
    
  6. Run the api:

    ./bin/api -db-dsn=<DATABASE_URL>
    

Usage

To check available endpoints and interact with the API, visit the OpenAPI spec doc.

Here's a quick example of how to create a new free time:

curl -X POST "http://localhost:4000/api/free" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{
        "start_time": "2024-09-19T12:00:22.094Z",
        "end_time": "2024-09-19T16:30:22.094Z",
        "tags": [
            "overwatch", "apex", "codm"
        ],
        "visibility": "private",
    }'

API Endpoints

Authentication

MethodEndpointRequire AuthDescription
POST/auth/signupFalseRegister new user
POST/auth/loginFalseSign in an existing user via email/pw
GET/auth/callbackFalseOauth callback handler

Users

MethodEndpointRequire AuthDescription
GET/users/{id}FalseFetch user's details
GET/users/{search}FalseSearch for a particular user
GET/users/meTrueFetch authenticated user's details
PATCH/users/meTrueUpdate authenticated user's details
DELETE/users/meTrueDelete authenticated user's account

Friends

MethodEndpointRequire AuthDescription
GET/friendsTrueFetch authenticated user's friends
GET/friends/searchTruesearch among authenticated user's friends
GET/friends/{id}TrueRemove authenticated user's friend
GET/friends/requests/sentTrueFetch authenticated user's outgoing friend requests
GET/friends/requests/receivedTrueFetch authenticated user's incoming friend requests
POST/friends/requestsTrueSend a friend request to a user
PUT/friends/requests/{id}TrueAccept incoming friend request
DELETE/friends/requests/{id}TrueReject incoming friend request/Cancel outgoing request
GET/friends/freeTrueFetch free time slots for authenticated user's friends
GET/friends/{id}/freeTrueFetch free time slots for authenticated user's friend

Free Time

MethodEndpointRequire AuthDescription
GET/freeTrueFetch authenticated user's free time slots
POST/freeTruePublish a new free time slot
PATCH/free/{id}TrueModify free time slot details
DELETE/free/{id}TrueRemove authenticated user's free time slot

For a full list of API endpoints and parameters, check the OpenAPI spec.

# Packages

No description provided by the author