Skip to content

Commit

Permalink
chore(server): add bgColor to story (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyshx committed Nov 6, 2023
1 parent f9e53a5 commit 93aba75
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 1 deletion.
2 changes: 2 additions & 0 deletions server/gql/storytelling.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Story implements Node {
sceneId: ID!
scene: Scene
panelPosition: Position!
bgColor: String

isBasicAuthActive: Boolean!
basicAuthUsername: String!
Expand Down Expand Up @@ -68,6 +69,7 @@ input UpdateStoryInput {
title: String
index: Int
panelPosition: Position
bgColor: String

# publishment
isBasicAuthActive: Boolean
Expand Down
83 changes: 82 additions & 1 deletion server/internal/adapter/gql/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions server/internal/adapter/gql/gqlmodel/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions server/internal/usecase/interactor/storytelling.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ func (i *Storytelling) Update(ctx context.Context, inp interfaces.UpdateStoryInp
story.SetPanelPosition(*inp.PanelPosition)
}

if inp.BgColor != nil {
story.SetBgColor(*inp.BgColor)
}

oldAlias := story.Alias()
if inp.Alias != nil && *inp.Alias != oldAlias {
if err := story.UpdateAlias(*inp.Alias); err != nil {
Expand Down
1 change: 1 addition & 0 deletions server/internal/usecase/interfaces/story.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type UpdateStoryInput struct {
Title *string
Index *int
PanelPosition *storytelling.Position
BgColor *string

IsBasicAuthActive *bool
BasicAuthUsername *string
Expand Down
5 changes: 5 additions & 0 deletions server/pkg/storytelling/story.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Story struct {
title string
pages *PageList
panelPosition Position
bgColor string
updatedAt time.Time

alias string
Expand Down Expand Up @@ -116,6 +117,10 @@ func (s *Story) SetPanelPosition(panelPosition Position) {
s.panelPosition = panelPosition
}

func (s *Story) SetBgColor(bgColor string) {
s.bgColor = bgColor
}

func (s *Story) Rename(name string) {
s.title = name
s.updatedAt = util.Now()
Expand Down

0 comments on commit 93aba75

Please sign in to comment.