generated from VLADIMIR/template
add load applications
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
package repos
|
||||
|
||||
type Application struct {
|
||||
Name string
|
||||
Image string
|
||||
TeamId int
|
||||
Name string
|
||||
Image string
|
||||
TeamId int
|
||||
FileType string
|
||||
}
|
||||
|
||||
@@ -27,15 +27,17 @@ func (r *ApplicationsRepo) AddApplication(
|
||||
teamId int,
|
||||
name string,
|
||||
image string,
|
||||
fileType string,
|
||||
) (int, error) {
|
||||
id := 0
|
||||
err := r.pool.QueryRow(
|
||||
ctx,
|
||||
`INSERT INTO applications (name, image, team_id)
|
||||
VALUES ($1, $2, $3)
|
||||
`INSERT INTO applications (name, image, file_type, team_id)
|
||||
VALUES ($1, $2, $3, $4)
|
||||
RETURNING id`,
|
||||
name,
|
||||
image,
|
||||
fileType,
|
||||
teamId,
|
||||
).Scan(&id)
|
||||
|
||||
@@ -55,6 +57,7 @@ func (r *ApplicationsRepo) GetApplicationsByTeamIDsAndState(
|
||||
`SELECT
|
||||
name,
|
||||
image,
|
||||
file_type,
|
||||
team_id
|
||||
FROM applications
|
||||
WHERE team_id = ANY($1) and status = $2`,
|
||||
@@ -72,6 +75,7 @@ func (r *ApplicationsRepo) GetApplicationsByTeamIDsAndState(
|
||||
err := rows.Scan(
|
||||
&application.Name,
|
||||
&application.Image,
|
||||
&application.FileType,
|
||||
&application.TeamId,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user