Skip to content

Accounting - #17

Open
CZnavody19 wants to merge 8 commits into
devfrom
feature/accounting
Open

Accounting#17
CZnavody19 wants to merge 8 commits into
devfrom
feature/accounting

Conversation

@CZnavody19

Copy link
Copy Markdown
Collaborator

No description provided.

@CZnavody19
CZnavody19 requested a review from espeletia January 17, 2024 16:00
Comment on lines +4 to +5

UPDATE pricelvlgroup SET commission=6 WHERE group_id IN (4,5);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These groups are not defined in other migrations, if this runs in an empty DB migrations will fail.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not sure i understand, the pricelvlgroup table is defined, the group_id column is also defined and the commission column is defined the line before.

Comment on lines +67 to +68

func (au *AccountingUsecase) GetMenuOrders2(ctx context.Context, restaurantId int, dateFrom time.Time, dateTo time.Time) ([]*domain.MenuOrder2, error) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better naming

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed all "MenuOrder2" to "AccountingOrder"

Comment thread internal/domain/accounting.go Outdated
Comment on lines +20 to +21
type MenuOrder2 struct {
Date time.Time

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better naming

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

Comment on lines +126 to +127

type MenuOrder2 struct {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better naming

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

Comment thread graph/mapper.go Outdated
Comment on lines +208 to +209

func (m Mapper) MapMenuOrders2(menuOrders2 []*domain.MenuOrder2) []*model.MenuOrders2 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better naming

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

Comment on lines +193 to +202
// crashes when notice is null - they are nullable
func mapCashAdvanceFromDB(cashAdvance model.Bankapi) *domain.CashAdvance {
return &domain.CashAdvance{
Id: int64(cashAdvance.ID),
Date: *cashAdvance.Date,
VariableSymbol: int64(*cashAdvance.Variablesym),
Amount: int64(cashAdvance.Amount),
Notice: getStringOrNil(cashAdvance.Notice),
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If notice is nil, then make the notice field a pointer...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +204 to +210
// this prevents crashes
func getStringOrNil(value *string) string {
if value == nil {
return ""
}
return (*value)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +48 to +49
OrderedMeals: -orderedMeals,
EndAdvance: startAdvance + float64(acceptedAdvance) - orderedMeals,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why negative?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the database returns a positive value but in the accounting it should be showcased as a negative

func (adbs *AccountingDatabaseStore) GetAcceptedAdvance(ctx context.Context, dateFrom time.Time, dateTo time.Time) (int, error) {
stmt := postgres.SELECT(postgres.SUM(table.Bankapi.Amount)).
FROM(table.Bankapi).
WHERE(table.Bankapi.Amount.GT(postgres.Int(0)).AND(table.Bankapi.Date.BETWEEN(postgres.Date(dateFrom.Year(), dateFrom.Month(), dateFrom.Day()), postgres.Date(dateTo.Year(), dateTo.Month(), dateTo.Day()))))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

money that we have accepted has a status of 1

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

Comment thread graph/accounting.graphqls Outdated
Comment on lines +13 to +14
Notice: String!
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullable field

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants