Skip to content

Commit

Permalink
bugfix: not able to store empty values
Browse files Browse the repository at this point in the history
  • Loading branch information
khanzadimahdi committed Aug 18, 2024
1 parent 03705a8 commit 97f5493
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 44 deletions.
20 changes: 10 additions & 10 deletions backend/infrastructure/repository/mongodb/articles/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
)

type ArticleBson struct {
UUID string `bson:"_id,omitempty"`
Cover string `bson:"cover,omitempty"`
Video string `bson:"video,omitempty"`
Title string `bson:"title,omitempty"`
Excerpt string `bson:"excerpt,omitempty"`
Body string `bson:"body,omitempty"`
PublishedAt time.Time `bson:"published_at,omitempty"`
AuthorUUID string `bson:"author_uuid,omitempty"`
Tags []string `bson:"tags,omitempty"`
ViewCount uint `bson:"view_count,omitempty"`
UUID string `bson:"_id"`
Cover string `bson:"cover"`
Video string `bson:"video"`
Title string `bson:"title"`
Excerpt string `bson:"excerpt"`
Body string `bson:"body"`
PublishedAt time.Time `bson:"published_at"`
AuthorUUID string `bson:"author_uuid"`
Tags []string `bson:"tags"`
ViewCount uint `bson:"view_count"`
CreatedAt time.Time `bson:"created_at"`
UpdatedAt time.Time `bson:"updated_at"`
}
Expand Down
18 changes: 9 additions & 9 deletions backend/infrastructure/repository/mongodb/comments/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import (
)

type CommentBson struct {
UUID string `bson:"_id,omitempty"`
Body string `bson:"body,omitempty"`
AuthorUUID string `bson:"author_uuid,omitempty"`
ParentUUID string `bson:"parent_uuid,omitempty"`
ObjectUUID string `bson:"object_uuid,omitempty"`
ObjectType string `bson:"object_type,omitempty"`
ApprovedAt time.Time `bson:"approved_at,omitempty"`
CreatedAt time.Time `bson:"created_at,omitempty"`
UpdatedAt time.Time `bson:"updated_at,omitempty"`
UUID string `bson:"_id"`
Body string `bson:"body"`
AuthorUUID string `bson:"author_uuid"`
ParentUUID string `bson:"parent_uuid"`
ObjectUUID string `bson:"object_uuid"`
ObjectType string `bson:"object_type"`
ApprovedAt time.Time `bson:"approved_at"`
CreatedAt time.Time `bson:"created_at"`
UpdatedAt time.Time `bson:"updated_at"`
}

type SetWrapper struct {
Expand Down
12 changes: 6 additions & 6 deletions backend/infrastructure/repository/mongodb/elements/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
)

type ElementBson struct {
UUID string `bson:"_id,omitempty"`
Type string `bson:"type,omitempty"`
Body element.Component `bson:"body,omitempty"`
Venues []string `bson:"venues,omitempty"`
CreatedAt time.Time `bson:"created_at,omitempty"`
UpdatedAt time.Time `bson:"updated_at,omitempty"`
UUID string `bson:"_id"`
Type string `bson:"type"`
Body element.Component `bson:"body"`
Venues []string `bson:"venues"`
CreatedAt time.Time `bson:"created_at"`
UpdatedAt time.Time `bson:"updated_at"`
}

func (e *ElementBson) UnmarshalBSON(data []byte) error {
Expand Down
10 changes: 5 additions & 5 deletions backend/infrastructure/repository/mongodb/files/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
)

type FileBson struct {
UUID string `bson:"_id,omitempty"`
Name string `bson:"name,omitempty"`
Size int64 `bson:"size,omitempty"`
OwnerUUID string `bson:"owner_uuid,omitempty"`
CreatedAt time.Time `bson:"created_at,omitempty"`
UUID string `bson:"_id"`
Name string `bson:"name"`
Size int64 `bson:"size"`
OwnerUUID string `bson:"owner_uuid"`
CreatedAt time.Time `bson:"created_at"`
}

type SetWrapper struct {
Expand Down
14 changes: 7 additions & 7 deletions backend/infrastructure/repository/mongodb/roles/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
)

type RoleBson struct {
UUID string `bson:"_id,omitempty"`
Name string `bson:"name,omitempty"`
Description string `bson:"description,omitempty"`
Permissions []string `bson:"permissions,omitempty"`
UserUUIDs []string `bson:"user_uuids,omitempty"`
CreatedAt time.Time `bson:"created_at,omitempty"`
UpdatedAt time.Time `bson:"updated_at,omitempty"`
UUID string `bson:"_id"`
Name string `bson:"name"`
Description string `bson:"description"`
Permissions []string `bson:"permissions"`
UserUUIDs []string `bson:"user_uuids"`
CreatedAt time.Time `bson:"created_at"`
UpdatedAt time.Time `bson:"updated_at"`
}

type SetWrapper struct {
Expand Down
14 changes: 7 additions & 7 deletions backend/infrastructure/repository/mongodb/users/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
)

type UserBson struct {
UUID string `bson:"_id,omitempty"`
Name string `bson:"name,omitempty"`
Avatar string `bson:"avatar,omitempty"`
Email string `bson:"email,omitempty"`
Username string `bson:"username,omitempty"`
PasswordHash PasswordHashBson `bson:"hash,omitempty"`
CreatedAt time.Time `bson:"created_at,omitempty"`
UUID string `bson:"_id"`
Name string `bson:"name"`
Avatar string `bson:"avatar"`
Email string `bson:"email"`
Username string `bson:"username"`
PasswordHash PasswordHashBson `bson:"hash"`
CreatedAt time.Time `bson:"created_at"`
}

type PasswordHashBson struct {
Expand Down

0 comments on commit 97f5493

Please sign in to comment.