-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #215 from Viva-con-Agua/feature/crew_event
Feature/crew event
- Loading branch information
Showing
13 changed files
with
382 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package dao | ||
|
||
import ( | ||
"context" | ||
"pool-backend/models" | ||
|
||
"github.com/Viva-con-Agua/vcago/vmod" | ||
) | ||
|
||
func EventStateHistoryInsert(ctx context.Context, i *models.EventStateHistoryCreate, token *models.AccessToken) (err error) { | ||
if err = EventStateHistoryCollection.InsertOne(ctx, i); err != nil { | ||
return | ||
} | ||
return | ||
} | ||
|
||
func EventStateHistoryGet(ctx context.Context, i *models.EventStateHistoryQuery, token *models.AccessToken) (result *[]models.EventStateHistory, list_size int64, err error) { | ||
result = new([]models.EventStateHistory) | ||
pipeline := models.EventStatePipeline().Match(i.Filter()) | ||
if err = EventStateHistoryCollection.Aggregate( | ||
ctx, | ||
pipeline.Pipe, | ||
result, | ||
); err != nil { | ||
return | ||
} | ||
count := vmod.Count{} | ||
var cErr error | ||
if cErr = EventStateHistoryCollection.AggregateOne(ctx, pipeline.Count().Pipe, &count); cErr != nil { | ||
print(cErr) | ||
list_size = 1 | ||
} else { | ||
list_size = int64(count.Total) | ||
} | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.