wip(frontend): adding more information

This commit is contained in:
2025-03-21 14:36:03 +00:00
parent ea5802b61b
commit 3541a4755c
9 changed files with 63 additions and 26 deletions

View File

@@ -15,5 +15,5 @@ type Events struct {
ID uuid.UUID `sql:"primary_key"`
Name string
Description *string
Location *uuid.UUID
LocationID *uuid.UUID
}

View File

@@ -20,7 +20,7 @@ type eventsTable struct {
ID postgres.ColumnString
Name postgres.ColumnString
Description postgres.ColumnString
Location postgres.ColumnString
LocationID postgres.ColumnString
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
@@ -64,9 +64,9 @@ func newEventsTableImpl(schemaName, tableName, alias string) eventsTable {
IDColumn = postgres.StringColumn("id")
NameColumn = postgres.StringColumn("name")
DescriptionColumn = postgres.StringColumn("description")
LocationColumn = postgres.StringColumn("location")
allColumns = postgres.ColumnList{IDColumn, NameColumn, DescriptionColumn, LocationColumn}
mutableColumns = postgres.ColumnList{NameColumn, DescriptionColumn, LocationColumn}
LocationIDColumn = postgres.StringColumn("location_id")
allColumns = postgres.ColumnList{IDColumn, NameColumn, DescriptionColumn, LocationIDColumn}
mutableColumns = postgres.ColumnList{NameColumn, DescriptionColumn, LocationIDColumn}
)
return eventsTable{
@@ -76,7 +76,7 @@ func newEventsTableImpl(schemaName, tableName, alias string) eventsTable {
ID: IDColumn,
Name: NameColumn,
Description: DescriptionColumn,
Location: LocationColumn,
LocationID: LocationIDColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,

View File

@@ -24,6 +24,12 @@ func getEventValues(event model.Events) []any {
arr = append(arr, nil)
}
if event.LocationID != nil {
arr = append(arr, *event.LocationID)
} else {
arr = append(arr, nil)
}
return arr
}

View File

@@ -79,7 +79,7 @@ func (m UserModel) ListWithProperties(ctx context.Context, userId uuid.UUID) ([]
LEFT_JOIN(ImageLocations, ImageLocations.ImageID.EQ(UserImages.ImageID)).
LEFT_JOIN(Locations, Locations.ID.EQ(ImageLocations.LocationID)).
LEFT_JOIN(ImageEvents, ImageEvents.ImageID.EQ(UserImages.ImageID)).
LEFT_JOIN(Events, Events.ID.EQ(ImageEvents.ID))).
LEFT_JOIN(Events, Events.ID.EQ(ImageEvents.EventID))).
WHERE(UserImages.UserID.EQ(UUID(userId)))
fmt.Println(listWithPropertiesStmt.DebugSql())

View File

@@ -74,7 +74,7 @@ CREATE TABLE haystack.events (
name TEXT NOT NULL,
description TEXT,
location UUID REFERENCES haystack.locations (id)
location_id UUID REFERENCES haystack.locations (id)
);
CREATE TABLE haystack.image_events (