Coder Social home page Coder Social logo

gobooplay's Introduction

Gooboplay

Hello evebody, my name is Saimon and I make this challange using Golang and MongoDb, this is a subscribe app like a stream platform, you want to buy a subscribe and use to see films.

how i test this project?

  • The first one you have to clone this project and command
go mod tidy
  • after you configure postman files and do not forgot add enviroments if you don't have enviroments in postman you have to create 2 variables
variable: access_token
initial value: ""

variable: localHost
initial value: http://localhost:8080/api/v1

  • after run the api
go run main.go

When you start the app you automatically create a trial subscription and an admin user:

POST {{localHost}}/account/login

body:

{
    "login":"admin",
    "password":"admin"
}

is return:

{
    "access_token": "..."
}

You can create a voucher in admin folder in Postman

POST {{localHost}}/voucher
Authorization Bearer token
{
    "name": "VOUCHERTEST",
    "price": 50.00,
    "description": "first voucher teste",
    "quantity":10
}

You can add products

POST {{localHost}}/product
Authorization Bearer token
{
    "Name": "Gooboplay subscription",
    "price": 12.34,
    "subscriptionTime": 4
}

ps: subscriptionTime in Months

or:

PUT {{localHost}}/product/productId

{
    "Name": "changed subscription",
    "price": 10.00,
    "subscriptionTime": 5
}

DELETE {{localHost}}/product/productId

with User:

you have to sign Up:

POST {{localHost}}/account/signup

{
    "login": "user",
    "password": "password",
    "name": "Saimon",
    "familyName": "Ribeiro",
    "gender": "MALE"
}

first time you have to get product to save a shooping cart ( you have to save a single product with admin user):

GET {{localHost}}/product/available-subscribe


response:
[
    {
        "id": "638e6d0e7eb899746c627ca2",
        "name": "Gooboplay subscription",
        "price": "12.34",
        "subscriptionTime": 4
    }
]

Save a product in shooping cart:

POST {{localHost}}/shopping-cart/product/638e6d0e7eb899746c627ca2

response

"id": "638f6b7bfd6bb29b8443ea05",
    "hash": "4769d",
    "product": {
        "id": "638e6d0e7eb899746c627ca2",
        "name": "Gooboplay subscription",
        "price": "12.34",
        "subscriptionTime": 4,
        "status": "ACTIVE",
        "createdAt": "2022-12-05T22:13:34.206Z",
        "updatedAt": "2022-12-05T22:13:34.206Z",
        "updateBy": {
            "username": "admin",
            "userId": "638e6b7f7eb899746c627ca0",
            "role": [
                "ADMIN"
            ]
        }
    },
    "price": "12.34",
    "finalPrice": "12.34",
    "owner": {
        "name": "saimon",
        "userId": "638e6d207eb899746c627ca4"
    },
    "voucher": {
        "id": "000000000000000000000000",
        "name": "",
        "description": "",
        "price": "0E-6176",
        "status": "",
        "quantity": 0,
        "createdAt": "0001-01-01T00:00:00Z",
        "updatedAt": "0001-01-01T00:00:00Z",
        "UpdateBy": {
            "name": "",
            "userId": ""
        }
    },
    "createdAt": "2022-12-06T16:19:07.165Z",
    "updateAt": "2022-12-06T16:19:07.165Z"
}

you can add a voucher, but only admin can make vouchers:

POST {{localHost}}/shopping-cart/voucher/638e6d177eb899746c627ca3

response

"id": "638f6b7bfd6bb29b8443ea05",
    "hash": "4769d",
    "product": {
        "id": "638e6d0e7eb899746c627ca2",
        "name": "Gooboplay subscription",
        "price": "12.34",
        "subscriptionTime": 4,
        "status": "ACTIVE",
        "createdAt": "2022-12-05T22:13:34.206Z",
        "updatedAt": "2022-12-05T22:13:34.206Z",
        "updateBy": {
            "username": "admin",
            "userId": "638e6b7f7eb899746c627ca0",
            "role": [
                "ADMIN"
            ]
        }
    },
    "price": "12.34",
    "finalPrice": "12.34",
    "owner": {
        "name": "saimon",
        "userId": "638e6d207eb899746c627ca4"
    },
    "voucher": {
        "id": "638e6d177eb899746c627ca3",
        "name": "VOUCHERTESTE",
        "description": "first voucher teste",
        "price": "50",
        "status": "ACTIVE",
        "quantity": 10,
        "createdAt": "2022-12-05T22:13:43.357Z",
        "updatedAt": "2022-12-05T22:13:43.357Z",
        "UpdateBy": {
            "name": "",
            "userId": ""
        }
    },
    "createdAt": "2022-12-06T16:19:07.165Z",
    "updateAt": "2022-12-06T16:19:07.165Z"
}

you can get or clean your shooping Cart

GET {{localHost}}/shopping-cart

POST {{localHost}}/shopping-cart/clear

for buy you have to send a order:

POST {{localHost}}/order/send

after this you buy a subscription, you have 1 trial month, if you want to see your subscription:

GET {{localHost}}/subscription

response:

{
    "id": "638e6d207eb899746c627ca5",
    "owner": {
        "name": "saimon",
        "userId": "638e6d207eb899746c627ca4"
    },
    "product": {
        "id": "638e6d0e7eb899746c627ca2",
        "name": "Assinatura mensal",
        "price": "12.34",
        "subscriptionTime": 4,
        "status": "ACTIVE",
        "createdAt": "2022-12-05T22:13:34.206Z",
        "updatedAt": "2022-12-05T22:13:34.206Z",
        "updateBy": {
            "username": "admin",
            "userId": "638e6b7f7eb899746c627ca0",
            "role": [
                "ADMIN"
            ]
        }
    },
    "status": "ACTIVE",
    "startedAt": "2022-12-05T22:13:52.275Z",
    "endAt": "2023-09-05T22:15:38.792Z",
    "restOfSubscription": 13044999814337448,
    "pauseAt": "2022-12-05T22:37:21.558Z",
    "createdAt": "2022-12-05T22:13:52.275Z",
    "updatedAt": "2022-12-06T16:52:28.082Z"
}

get rest of your subscription

GET {{localHost}}/subscription/rest

response:
"6556.875215 Hours"

Pause or Cancel your subscription:

POST {{localHost}}/subscription/pause
DELETE {{localHost}}/subscription/cancel

when you cancel your subscription you only change status to DISABLED

if you have time in your subscription you can see all in platform:

GET {{localHost}}/movies

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.