Add initial user API #26
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request introduces a new user management feature to the backend system. It includes database schema updates for both PostgreSQL and SQLite, a new
UserService
with REST API endpoints, and supporting models, handlers, and data storage logic. Below are the most important changes grouped by theme:Database Schema Updates
USER
table to both PostgreSQL (postgress.sql
) and SQLite (sqlite.sql
) schemas to store user details such asUSER_ID
,ORG_ID
,TYPE
, andATTRIBUTES
. The table includes timestamps forCREATED_AT
andUPDATED_AT
. [1] [2]USER
table in both PostgreSQL and SQLite scripts. [1] [2]Service Layer Implementation
UserService
inuserservice.go
to handle user-related operations, including creating, retrieving, updating, and deleting users. The service is registered in theServiceManager
. [1] [2]REST API for User Management
UserHandler
inuserhandler.go
to define REST API endpoints (POST
,GET
,PUT
,DELETE
) for user management. Each endpoint is mapped to a corresponding service method.Supporting Models and Providers
User
model inuser.go
to represent user data, includingId
,OrgId
,Type
, andAttributes
.UserProvider
inuserprovider.go
to abstract the creation and retrieval of theUserService
instance.Data Storage Layer
constants.go
under thestore
package. These queries are used by theUserService
to interact with the database.