TP-55555|SourceMap get api from client,post api for storing
This commit is contained in:
39
service/sourceMap.go
Normal file
39
service/sourceMap.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"cybertron/models/db"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type SourceMapService struct {
|
||||
dbClient *gorm.DB
|
||||
}
|
||||
|
||||
func NewSourceMapService(dbClient *gorm.DB) *SourceMapService {
|
||||
return &SourceMapService{
|
||||
dbClient: dbClient,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SourceMapService) GetSourceMap() db.SourceMap {
|
||||
//fetching SourceMap from a client API
|
||||
sourceMap := db.SourceMap{
|
||||
Model: gorm.Model{
|
||||
ID: 1,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
DeletedAt: gorm.DeletedAt{},
|
||||
},
|
||||
ReleaseReferenceId: "some-release-ref-id",
|
||||
ProjectReferenceId: "some-project-ref-id",
|
||||
SourceMapZipUrl: "http://example.com/sourcemap.zip",
|
||||
}
|
||||
|
||||
return sourceMap
|
||||
}
|
||||
|
||||
func (s *SourceMapService) StoreSourceMap(sourceMap db.SourceMap) error {
|
||||
return s.dbClient.Create(&sourceMap).Error
|
||||
}
|
||||
Reference in New Issue
Block a user