Skip to content

Commit

Permalink
Merge pull request #41 from mffonseca/feature/melhorias-ci
Browse files Browse the repository at this point in the history
Atualizando repositório com ajustes para o ci e validação de erro
  • Loading branch information
mffonseca authored Jul 31, 2024
2 parents f5a308d + c6dd23c commit d612167
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ __debug*
#misc
.DS_Store
backend/.env

frontend/package-lock.json
4 changes: 2 additions & 2 deletions backend/internal/auth/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package auth

import (
"context"
"fmt"
"errors"
"net/http"

"golang.org/x/oauth2"
Expand All @@ -11,7 +11,7 @@ import (
func CreateOAuthClient(ctx context.Context, oauthConfig *oauth2.Config, token *oauth2.Token) (*http.Client, error) {
client := oauthConfig.Client(ctx, token)
if client == nil {
return nil, fmt.Errorf("failed to create OAuth client")
return nil, errors.New("error creating OAuth client")
}
return client, nil
}
8 changes: 4 additions & 4 deletions backend/internal/services/calendar_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ type EventCall interface {
}

type RealCalendarService struct {
GoogleCalendar *calendar.Service
CalendarService *calendar.Service
}

func (rcs *RealCalendarService) EventsList(calendarID string) EventsListCall {
return &realEventsListCall{
call: rcs.GoogleCalendar.Events.List(calendarID),
call: rcs.CalendarService.Events.List(calendarID),
}
}

func (rcs *RealCalendarService) GetEvent(calendarID, eventID string) EventCall {
return &realEventCall{
getCall: rcs.GoogleCalendar.Events.Get(calendarID, eventID),
getCall: rcs.CalendarService.Events.Get(calendarID, eventID),
}
}

func (rcs *RealCalendarService) UpdateEvent(calendarID, eventID string, event *calendar.Event) EventCall {
return &realUpdateEventCall{
updateCall: rcs.GoogleCalendar.Events.Update(calendarID, eventID, event),
updateCall: rcs.CalendarService.Events.Update(calendarID, eventID, event),
}
}

Expand Down
2 changes: 1 addition & 1 deletion backend/internal/services/google_calendar_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (googleCalendarService *GoogleCalendarService) InitializeService(ctx contex
if err != nil {
return nil, fmt.Errorf("error creating calendar service: %v", err)
}
return &RealCalendarService{GoogleCalendar: service}, nil
return &RealCalendarService{CalendarService: service}, nil
}

func (googleCalendarService *GoogleCalendarService) FindEventByKey(ctx context.Context, api CalendarAPI, eventKey string) (*calendar.Event, error) {
Expand Down
6 changes: 3 additions & 3 deletions backend/tests/google_calendar_service_mocks.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package services

import (
"errors"
"faladev/internal/services"
"fmt"

"google.golang.org/api/calendar/v3"
)
Expand Down Expand Up @@ -42,7 +42,7 @@ func (f *FakeEventsListCall) Do() (*calendar.Events, error) {
if f.DoFunc != nil {
return f.DoFunc()
}
return nil, fmt.Errorf("Do function not implemented")
return nil, errors.New("Do function not implemented")
}

type FakeEventCall struct {
Expand All @@ -53,5 +53,5 @@ func (f *FakeEventCall) Do() (*calendar.Event, error) {
if f.DoFunc != nil {
return f.DoFunc()
}
return nil, fmt.Errorf("Do function not implemented")
return nil, errors.New("Do function not implemented")
}
4 changes: 2 additions & 2 deletions backend/tests/google_calendar_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ func TestFindEventByKey(t *testing.T) {
},
}

gcs := services.GoogleCalendarService{}
googleCalendarService := services.GoogleCalendarService{}

event, err := gcs.FindEventByKey(context.Background(), mockService, tt.eventKey)
event, err := googleCalendarService.FindEventByKey(context.Background(), mockService, tt.eventKey)

if tt.expectedError != "" {
assert.EqualError(t, err, tt.expectedError)
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@storybook/react": "^8.2.5",
"@storybook/test": "^8.2.5",
"@testing-library/react": "^16.0.0",
"@types/node": "^20",
"@types/node": "^20.14.13",
"@types/react": "^18",
"@types/react-dom": "^18",
"@vitejs/plugin-react": "^4.3.1",
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/app/(mentoring)/mentoring.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { IMentoringAgendaService } from '@/services/MentoringAgenda/IMentoringAgendaService.model'
import { useForm } from 'react-hook-form'
import { useForm } from 'react-hook-form';

import { IMentoringAgendaService } from '@/services/MentoringAgenda/IMentoringAgendaService.model';


export function useMentoringModel(service: IMentoringAgendaService) {
const {} = useForm()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { apiBFF } from '../apiBFF'
import { IMentoringAgendaService } from './IMentoringAgendaService.model'
import { apiBFF } from '../apiBFF';

import { IMentoringAgendaService } from './IMentoringAgendaService.model';

export class MentoringAgendaService implements IMentoringAgendaService {
async SignUpMentoring() {
const { data } = await apiBFF.post('/')
return data
const { data } = await apiBFF.post('/');
return data;
}
}

0 comments on commit d612167

Please sign in to comment.