initial commit
This commit is contained in:
commit
e7987e88a7
70 changed files with 13661 additions and 0 deletions
137
internal/service/experience_service.go
Normal file
137
internal/service/experience_service.go
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/dnoulet/go-first/internal/model"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type ExperienceService struct {
|
||||
mu sync.RWMutex
|
||||
experiences map[uuid.UUID]*model.Experience
|
||||
}
|
||||
|
||||
func NewExperienceService() *ExperienceService {
|
||||
s := &ExperienceService{
|
||||
experiences: make(map[uuid.UUID]*model.Experience),
|
||||
}
|
||||
s.seedData()
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *ExperienceService) seedData() {
|
||||
experiences := []*model.Experience{
|
||||
{
|
||||
ID: uuid.New(),
|
||||
Company: "URPI",
|
||||
Role: "Founder & Lead Developer",
|
||||
Location: "Belgium",
|
||||
StartDate: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
EndDate: nil,
|
||||
Current: true,
|
||||
Description: "Founded URPI to provide web application and backend development services. Specializing in Go, Java, and cloud-native architectures. Delivered projects for clients in fintech, e-commerce, and SaaS sectors.",
|
||||
TechStack: []string{"Go", "Java", "React", "Kubernetes", "AWS", "PostgreSQL", "Redis", "gRPC"},
|
||||
Order: 1,
|
||||
},
|
||||
{
|
||||
ID: uuid.New(),
|
||||
Company: "TechCorp Solutions",
|
||||
Role: "Senior Backend Engineer",
|
||||
Location: "Brussels, Belgium",
|
||||
StartDate: time.Date(2017, 6, 1, 0, 0, 0, 0, time.UTC),
|
||||
EndDate: ptrTime(time.Date(2019, 12, 31, 0, 0, 0, 0, time.UTC)),
|
||||
Current: false,
|
||||
Description: "Led backend development for high-scale financial services platform. Designed and implemented microservices architecture, CI/CD pipelines, and monitoring infrastructure. Mentored junior developers and conducted code reviews.",
|
||||
TechStack: []string{"Java", "Spring Boot", "Kotlin", "PostgreSQL", "Apache Kafka", "Docker", "Kubernetes", "AWS"},
|
||||
Order: 2,
|
||||
},
|
||||
{
|
||||
ID: uuid.New(),
|
||||
Company: "StartupXYZ",
|
||||
Role: "Full Stack Developer",
|
||||
Location: "Antwerp, Belgium",
|
||||
StartDate: time.Date(2015, 3, 1, 0, 0, 0, 0, time.UTC),
|
||||
EndDate: ptrTime(time.Date(2017, 5, 31, 0, 0, 0, 0, time.UTC)),
|
||||
Current: false,
|
||||
Description: "Built and maintained full-stack web applications for various clients. Worked with React, Node.js, Python, and Ruby on Rails. Implemented REST APIs, real-time features, and automated testing pipelines.",
|
||||
TechStack: []string{"React", "Node.js", "Python", "Ruby on Rails", "PostgreSQL", "MongoDB", "AWS", "Docker"},
|
||||
Order: 3,
|
||||
},
|
||||
{
|
||||
ID: uuid.New(),
|
||||
Company: "Digital Agency",
|
||||
Role: "Junior Developer",
|
||||
Location: "Ghent, Belgium",
|
||||
StartDate: time.Date(2013, 9, 1, 0, 0, 0, 0, time.UTC),
|
||||
EndDate: ptrTime(time.Date(2015, 2, 28, 0, 0, 0, 0, time.UTC)),
|
||||
Current: false,
|
||||
Description: "Started career building websites and web applications for SME clients. Learned PHP, JavaScript, MySQL, and modern frontend frameworks. Developed custom CMS solutions and e-commerce integrations.",
|
||||
TechStack: []string{"PHP", "JavaScript", "MySQL", "HTML/CSS", "jQuery", "WordPress", "Magento"},
|
||||
Order: 4,
|
||||
},
|
||||
}
|
||||
|
||||
for _, exp := range experiences {
|
||||
s.experiences[exp.ID] = exp
|
||||
}
|
||||
}
|
||||
|
||||
func ptrTime(t time.Time) *time.Time {
|
||||
return &t
|
||||
}
|
||||
|
||||
func (s *ExperienceService) GetAll(ctx context.Context) ([]*model.Experience, error) {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
|
||||
var result []*model.Experience
|
||||
for _, exp := range s.experiences {
|
||||
result = append(result, exp)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (s *ExperienceService) GetByID(ctx context.Context, id uuid.UUID) (*model.Experience, error) {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
|
||||
exp, ok := s.experiences[id]
|
||||
if !ok {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
return exp, nil
|
||||
}
|
||||
|
||||
func (s *ExperienceService) Create(ctx context.Context, exp *model.Experience) (*model.Experience, error) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
exp.ID = uuid.New()
|
||||
s.experiences[exp.ID] = exp
|
||||
return exp, nil
|
||||
}
|
||||
|
||||
func (s *ExperienceService) Update(ctx context.Context, exp *model.Experience) (*model.Experience, error) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
if _, ok := s.experiences[exp.ID]; !ok {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
s.experiences[exp.ID] = exp
|
||||
return exp, nil
|
||||
}
|
||||
|
||||
func (s *ExperienceService) Delete(ctx context.Context, id uuid.UUID) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
if _, ok := s.experiences[id]; !ok {
|
||||
return ErrNotFound
|
||||
}
|
||||
delete(s.experiences, id)
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue