feat: implement core backend architecture and project management services for the History API
Build and Release / release (push) Successful in 1m33s
Build and Release / release (push) Successful in 1m33s
This commit is contained in:
@@ -34,7 +34,7 @@ func (b *BattleReplayEntity) ToResponse() *response.BattleReplayResponse {
|
||||
}
|
||||
|
||||
func BattleReplaysEntityToResponse(bs []*BattleReplayEntity) []*response.BattleReplayResponse {
|
||||
out := make([]*response.BattleReplayResponse, 0)
|
||||
out := make([]*response.BattleReplayResponse, 0, len(bs))
|
||||
if bs == nil {
|
||||
return out
|
||||
}
|
||||
|
||||
+24
-24
@@ -6,17 +6,17 @@ import (
|
||||
)
|
||||
|
||||
type EntityEntity struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description"`
|
||||
ProjectID string `json:"project_id"`
|
||||
Status *int16 `json:"status"`
|
||||
TimeStart *int32 `json:"time_start"`
|
||||
TimeEnd *int32 `json:"time_end"`
|
||||
IsDeleted bool `json:"is_deleted"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description"`
|
||||
ProjectID string `json:"project_id"`
|
||||
Status *int16 `json:"status"`
|
||||
TimeStart *int32 `json:"time_start"`
|
||||
TimeEnd *int32 `json:"time_end"`
|
||||
IsDeleted bool `json:"is_deleted"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (e *EntityEntity) ToResponse() *response.EntityResponse {
|
||||
@@ -24,25 +24,25 @@ func (e *EntityEntity) ToResponse() *response.EntityResponse {
|
||||
return nil
|
||||
}
|
||||
return &response.EntityResponse{
|
||||
ID: e.ID,
|
||||
Name: e.Name,
|
||||
Slug: e.Slug,
|
||||
Description: e.Description,
|
||||
ProjectID: e.ProjectID,
|
||||
Status: e.Status,
|
||||
TimeStart: e.TimeStart,
|
||||
TimeEnd: e.TimeEnd,
|
||||
IsDeleted: e.IsDeleted,
|
||||
CreatedAt: e.CreatedAt,
|
||||
UpdatedAt: e.UpdatedAt,
|
||||
ID: e.ID,
|
||||
Name: e.Name,
|
||||
Slug: e.Slug,
|
||||
Description: e.Description,
|
||||
ProjectID: e.ProjectID,
|
||||
Status: e.Status,
|
||||
TimeStart: e.TimeStart,
|
||||
TimeEnd: e.TimeEnd,
|
||||
IsDeleted: e.IsDeleted,
|
||||
CreatedAt: e.CreatedAt,
|
||||
UpdatedAt: e.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func EntitiesEntityToResponse(es []*EntityEntity) []*response.EntityResponse {
|
||||
out := make([]*response.EntityResponse, 0)
|
||||
if es == nil {
|
||||
return out
|
||||
return []*response.EntityResponse{}
|
||||
}
|
||||
out := make([]*response.EntityResponse, 0, len(es))
|
||||
for _, e := range es {
|
||||
if e == nil {
|
||||
continue
|
||||
|
||||
@@ -52,10 +52,10 @@ func (g *GeometryEntity) ToResponse() *response.GeometryResponse {
|
||||
}
|
||||
|
||||
func GeometriesEntityToResponse(gs []*GeometryEntity) []*response.GeometryResponse {
|
||||
out := make([]*response.GeometryResponse, 0)
|
||||
if gs == nil {
|
||||
return out
|
||||
return []*response.GeometryResponse{}
|
||||
}
|
||||
out := make([]*response.GeometryResponse, 0, len(gs))
|
||||
for _, g := range gs {
|
||||
if g == nil {
|
||||
continue
|
||||
|
||||
@@ -90,7 +90,7 @@ func (e *MediaEntity) ToSimpleEntity() *MediaSimpleEntity {
|
||||
}
|
||||
|
||||
func MediaEntitiesToResponse(entities []*MediaEntity) []*response.MediaResponse {
|
||||
responses := make([]*response.MediaResponse, 0)
|
||||
responses := make([]*response.MediaResponse, 0, len(entities))
|
||||
if entities == nil {
|
||||
return responses
|
||||
}
|
||||
@@ -104,7 +104,7 @@ func MediaEntitiesToResponse(entities []*MediaEntity) []*response.MediaResponse
|
||||
}
|
||||
|
||||
func MediaEntitiesToStorageEntity(entities []*MediaEntity) []*MediaStorageEntity {
|
||||
responses := make([]*MediaStorageEntity, 0)
|
||||
responses := make([]*MediaStorageEntity, 0, len(entities))
|
||||
if entities == nil {
|
||||
return responses
|
||||
}
|
||||
@@ -118,7 +118,7 @@ func MediaEntitiesToStorageEntity(entities []*MediaEntity) []*MediaStorageEntity
|
||||
}
|
||||
|
||||
func MediaSimpleEntitiesToResponse(entities []*MediaSimpleEntity) []*response.MediaSimpleResponse {
|
||||
responses := make([]*response.MediaSimpleResponse, 0)
|
||||
responses := make([]*response.MediaSimpleResponse, 0, len(entities))
|
||||
if entities == nil {
|
||||
return responses
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"history-api/internal/dtos/response"
|
||||
"history-api/pkg/constants"
|
||||
json "history-api/pkg/jsonx"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -127,7 +127,7 @@ func (p *ProjectEntity) ToResponse() *response.ProjectResponse {
|
||||
}
|
||||
|
||||
func ProjectsEntityToResponse(projects []*ProjectEntity) []*response.ProjectResponse {
|
||||
out := make([]*response.ProjectResponse, 0)
|
||||
out := make([]*response.ProjectResponse, 0, len(projects))
|
||||
if projects == nil {
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func (r *RoleEntity) ToRoleSimple() *RoleSimple {
|
||||
}
|
||||
|
||||
func RolesEntityToResponse(rs []*RoleEntity) []*response.RoleResponse {
|
||||
out := make([]*response.RoleResponse, 0)
|
||||
out := make([]*response.RoleResponse, 0, len(rs))
|
||||
if rs == nil {
|
||||
return out
|
||||
}
|
||||
@@ -75,7 +75,7 @@ func RolesEntityToResponse(rs []*RoleEntity) []*response.RoleResponse {
|
||||
}
|
||||
|
||||
func RolesEntityToRoleConstant(rs []*RoleSimple) []constants.RoleType {
|
||||
out := make([]constants.RoleType, 0)
|
||||
out := make([]constants.RoleType, 0, len(rs))
|
||||
if rs == nil {
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"history-api/internal/dtos/response"
|
||||
"history-api/pkg/constants"
|
||||
json "history-api/pkg/jsonx"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -65,7 +65,7 @@ func (s *SubmissionEntity) ToResponse() *response.SubmissionResponse {
|
||||
}
|
||||
|
||||
func SubmissionsEntityToResponse(submissions []*SubmissionEntity) []*response.SubmissionResponse {
|
||||
out := make([]*response.SubmissionResponse, 0)
|
||||
out := make([]*response.SubmissionResponse, 0, len(submissions))
|
||||
if submissions == nil {
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"history-api/internal/dtos/response"
|
||||
json "history-api/pkg/jsonx"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -76,7 +76,7 @@ func (u *UserEntity) ToResponse() *response.UserResponse {
|
||||
}
|
||||
|
||||
func UsersEntityToResponse(users []*UserEntity) []*response.UserResponse {
|
||||
out := make([]*response.UserResponse, 0)
|
||||
out := make([]*response.UserResponse, 0, len(users))
|
||||
if users == nil {
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"history-api/internal/dtos/response"
|
||||
"history-api/pkg/constants"
|
||||
json "history-api/pkg/jsonx"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -77,7 +77,7 @@ func (u *UserVerificationEntity) ToResponse() *response.UserVerificationResponse
|
||||
}
|
||||
|
||||
func UserVerificationsEntitiesToResponse(entities []*UserVerificationEntity) []*response.UserVerificationResponse {
|
||||
responses := make([]*response.UserVerificationResponse, 0)
|
||||
responses := make([]*response.UserVerificationResponse, 0, len(entities))
|
||||
if entities == nil {
|
||||
return responses
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ func (w *WikiEntity) ToResponse() *response.WikiResponse {
|
||||
if w == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var contentSample []response.WikiContentSample
|
||||
|
||||
contentSample := make([]response.WikiContentSample, 0, len(w.ContentSample))
|
||||
for _, c := range w.ContentSample {
|
||||
contentSample = append(contentSample, response.WikiContentSample{
|
||||
ID: c.ID,
|
||||
@@ -49,10 +49,10 @@ func (w *WikiEntity) ToResponse() *response.WikiResponse {
|
||||
}
|
||||
|
||||
func WikisEntityToResponse(ws []*WikiEntity) []*response.WikiResponse {
|
||||
out := make([]*response.WikiResponse, 0)
|
||||
if ws == nil {
|
||||
return out
|
||||
return []*response.WikiResponse{}
|
||||
}
|
||||
out := make([]*response.WikiResponse, 0, len(ws))
|
||||
for _, w := range ws {
|
||||
if w == nil {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user