Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/danielmensah/user-management

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/danielmensah/user-management

  • v0.0.0-20220824072411-a1a1332be063
  • Source
  • Go
  • Socket score

Version published
Created
Source

User Management

Go Report Card

This is a small microservice to manage access to Users.

Requirements

These dependencies can also be installed with Homebrew.

  • Requires Go 1.18 or greater. This can be installed with brew brew install go or downloaded here.
  • Requires Golangci Lint. This can be installed with brew brew install golangci-lint or downloaded here.
  • Requires Docker and Docker Compose. This can be installed with brew brew install docker or downloaded here.

Install Dependencies

Install dependencies, issue the following command(s):

make install

Testing and Formatting

To run the tests, issue the following command(s):

make test
Lint only

Run linting only:

make lint

How to Run

To run the application, simply issue the following example command(s):

make local

Environment Variables

Environment variables needed to start the application are:

VariableDescriptionRequiredExample/Default
API_HOSTHost that the exposed api endpoints should be run on:x:0.0.0.0
API_PORTPort that the exposed api endpoints will listen on for request:x:8000
API_MONGO_URIMongo instance URImongodb://mongo:27017
API_MONGO_DB_NAMEMongo Database Name to initializeusermanagement

API Endpoints

Base URLs:

Health check

GET /_healthz

Returns 200 if the service is up and running

Example responses

200 Response

"OK"

Responses

StatusMeaningDescriptionSchema
200OKService is up and runningstring

getUsers

GET /users

Parameters

NameInTypeRequiredDescription
countryquerystringfalseUser country
emailquerystringfalseUser email
pagequeryinteger(int64)truePage number
limitqueryinteger(int64)trueNumber of users per page

Example responses

200 Response

{
  "users": [
    {
      "_id": "string",
      "first_name": "John",
      "last_name": "Doe",
      "nickname": "jd",
      "email": "js@example.com",
      "country": "UK",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ]
}

Responses

StatusMeaningDescriptionSchema
200OKA list of usersGetUsersResponse
400Bad RequestInvalid requestError
500Internal Server ErrorInternal server errorError
This operation does not require authentication

createUser

POST /users

Body parameter

{
  "first_name": "John",
  "last_name": "Doe",
  "nickname": "jd",
  "email": "js@example.com",
  "password": "worm",
  "country": "UK"
}

Parameters

NameInTypeRequiredDescription
bodybodyUserCreateDatafalsenone

Example responses

201 Response

{
  "_id": "string"
}

Responses

StatusMeaningDescriptionSchema
201CreatedCreated userCreateUserResponse
400Bad RequestInvalid requestError
500Internal Server ErrorInternal server errorError

deleteUser

DELETE /users/{id}

Parameters

NameInTypeRequiredDescription
idpathstringtrueUser ID

Example responses

400 Response

{
  "message": "string"
}

Responses

StatusMeaningDescriptionSchema
204No ContentDeleted userNone
400Bad RequestInvalid requestError
500Internal Server ErrorInternal server errorError

updateUser

PUT /users/{id}

Body parameter

{
  "first_name": "John",
  "last_name": "Doe",
  "nickname": "jd",
  "email": "js@example.com",
  "password": "worm",
  "country": "UK"
}

Parameters

NameInTypeRequiredDescription
idpathstringtrueUser ID
bodybodyUserUpdateDatafalsenone

Example responses

200 Response

{
  "_id": "string",
  "first_name": "John",
  "last_name": "Doe",
  "nickname": "jd",
  "email": "js@example.com",
  "country": "UK",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}

Responses

StatusMeaningDescriptionSchema
200OKUpdated userUser
400Bad RequestInvalid requestError
500Internal Server ErrorInternal server errorError

Schemas

GetUsersResponse

{
  "users": [
    {
      "_id": "string",
      "first_name": "John",
      "last_name": "Doe",
      "nickname": "jd",
      "email": "js@example.com",
      "country": "UK",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ]
}

Properties

NameTypeRequiredRestrictionsDescription
users[User]falsenonenone

CreateUserResponse

{
  "_id": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
_idIdtruenonenone

User

{
  "_id": "string",
  "first_name": "John",
  "last_name": "Doe",
  "nickname": "jd",
  "email": "js@example.com",
  "country": "UK",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}

Properties

NameTypeRequiredRestrictionsDescription
_idIdtruenonenone
first_nameFirstNametruenonenone
last_nameLastNametruenonenone
nicknameNicknametruenonenone
emailEmailtruenonenone
countryCountrytruenonenone
created_atCreatedAttruenonenone
updated_atUpdatedAttruenonenone

UserUpdateData

{
  "first_name": "John",
  "last_name": "Doe",
  "nickname": "jd",
  "email": "js@example.com",
  "password": "worm",
  "country": "UK"
}

Properties

NameTypeRequiredRestrictionsDescription
first_nameFirstNamefalsenonenone
last_nameLastNamefalsenonenone
nicknameNicknamefalsenonenone
emailEmailfalsenonenone
passwordPasswordfalsenonenone
countryCountryfalsenonenone

UserCreateData

{
  "first_name": "John",
  "last_name": "Doe",
  "nickname": "jd",
  "email": "js@example.com",
  "password": "worm",
  "country": "UK"
}

Properties

NameTypeRequiredRestrictionsDescription
first_nameFirstNametruenonenone
last_nameLastNametruenonenone
nicknameNicknametruenonenone
emailEmailtruenonenone
passwordPasswordtruenonenone
countryCountrytruenonenone

Error

{
  "message": "string"
}

Properties

NameTypeRequiredRestrictionsDescription
messagestringtruenonenone

Id

"string"

Properties

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

FirstName

"John"

Properties

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

LastName

"Doe"

Properties

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Nickname

"jd"

Properties

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Email

"js@example.com"

Properties

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Password

"worm"

Properties

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Country

"UK"

Properties

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

CreatedAt

"2019-08-24T14:15:22Z"

Properties

NameTypeRequiredRestrictionsDescription
anonymousstring(date-time)falsenonenone

UpdatedAt

"2019-08-24T14:15:22Z"

Properties

NameTypeRequiredRestrictionsDescription
anonymousstring(date-time)falsenonenone

FAQs

Package last updated on 24 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc