v0.0.30.1 Поле title при создании клипа сделано не обязательное
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7ae6060e61
commit
2282c5b1ac
@ -68,12 +68,17 @@ func (r *clipLikeResolver) CreatedAt(ctx context.Context, obj *domain.ClipLike)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CreateClip is the resolver for the createClip field.
|
// CreateClip is the resolver for the createClip field.
|
||||||
func (r *mutationResolver) CreateClip(ctx context.Context, title string, video graphql.Upload) (*domain.Clip, error) {
|
func (r *mutationResolver) CreateClip(ctx context.Context, title *string, video graphql.Upload) (*domain.Clip, error) {
|
||||||
userID, err := getUserIDFromContext(ctx)
|
userID, err := getUserIDFromContext(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("user not authenticated: %w", err)
|
return nil, fmt.Errorf("user not authenticated: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var clipTitle string
|
||||||
|
if title != nil {
|
||||||
|
clipTitle = *title
|
||||||
|
}
|
||||||
|
|
||||||
// Читаем данные видео
|
// Читаем данные видео
|
||||||
videoData, err := io.ReadAll(video.File)
|
videoData, err := io.ReadAll(video.File)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -82,7 +87,7 @@ func (r *mutationResolver) CreateClip(ctx context.Context, title string, video g
|
|||||||
|
|
||||||
resp, err := r.ClipClient.CreateClip(ctx, &proto.CreateClipRequest{
|
resp, err := r.ClipClient.CreateClip(ctx, &proto.CreateClipRequest{
|
||||||
UserId: int32(userID),
|
UserId: int32(userID),
|
||||||
Title: title,
|
Title: clipTitle,
|
||||||
VideoData: videoData,
|
VideoData: videoData,
|
||||||
FileName: video.Filename,
|
FileName: video.Filename,
|
||||||
ContentType: video.ContentType,
|
ContentType: video.ContentType,
|
||||||
|
|||||||
@ -172,7 +172,7 @@ type ComplexityRoot struct {
|
|||||||
ChangePassword func(childComplexity int, oldPassword string, newPassword string) int
|
ChangePassword func(childComplexity int, oldPassword string, newPassword string) int
|
||||||
ConfirmEmail func(childComplexity int, token string) int
|
ConfirmEmail func(childComplexity int, token string) int
|
||||||
CreateChat func(childComplexity int, user1Id int, user2Id int) int
|
CreateChat func(childComplexity int, user1Id int, user2Id int) int
|
||||||
CreateClip func(childComplexity int, title string, video graphql.Upload) int
|
CreateClip func(childComplexity int, title *string, video graphql.Upload) int
|
||||||
CreateClipComment func(childComplexity int, clipID int, content string) int
|
CreateClipComment func(childComplexity int, clipID int, content string) int
|
||||||
CreateComment func(childComplexity int, postID int, content string) int
|
CreateComment func(childComplexity int, postID int, content string) int
|
||||||
CreatePost func(childComplexity int, title string, content graphql.Upload) int
|
CreatePost func(childComplexity int, title string, content graphql.Upload) int
|
||||||
@ -355,7 +355,7 @@ type MutationResolver interface {
|
|||||||
FollowUser(ctx context.Context, followingID int) (*FollowResult, error)
|
FollowUser(ctx context.Context, followingID int) (*FollowResult, error)
|
||||||
UnfollowUser(ctx context.Context, followingID int) (*UnfollowResult, error)
|
UnfollowUser(ctx context.Context, followingID int) (*UnfollowResult, error)
|
||||||
MarkNotificationAsRead(ctx context.Context, notificationID int) (*MarkNotificationReadResult, error)
|
MarkNotificationAsRead(ctx context.Context, notificationID int) (*MarkNotificationReadResult, error)
|
||||||
CreateClip(ctx context.Context, title string, video graphql.Upload) (*domain.Clip, error)
|
CreateClip(ctx context.Context, title *string, video graphql.Upload) (*domain.Clip, error)
|
||||||
DeleteClip(ctx context.Context, id int) (bool, error)
|
DeleteClip(ctx context.Context, id int) (bool, error)
|
||||||
LikeClip(ctx context.Context, clipID int) (*domain.ClipLike, error)
|
LikeClip(ctx context.Context, clipID int) (*domain.ClipLike, error)
|
||||||
UnlikeClip(ctx context.Context, clipID int) (bool, error)
|
UnlikeClip(ctx context.Context, clipID int) (bool, error)
|
||||||
@ -943,7 +943,7 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Mutation.CreateClip(childComplexity, args["title"].(string), args["video"].(graphql.Upload)), true
|
return e.complexity.Mutation.CreateClip(childComplexity, args["title"].(*string), args["video"].(graphql.Upload)), true
|
||||||
|
|
||||||
case "Mutation.createClipComment":
|
case "Mutation.createClipComment":
|
||||||
if e.complexity.Mutation.CreateClipComment == nil {
|
if e.complexity.Mutation.CreateClipComment == nil {
|
||||||
@ -2082,7 +2082,7 @@ func (ec *executionContext) field_Mutation_createClipComment_args(ctx context.Co
|
|||||||
func (ec *executionContext) field_Mutation_createClip_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
|
func (ec *executionContext) field_Mutation_createClip_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]any{}
|
args := map[string]any{}
|
||||||
arg0, err := processArgField(ctx, rawArgs, "title", ec.unmarshalNString2string)
|
arg0, err := processArgField(ctx, rawArgs, "title", ec.unmarshalOString2ᚖstring)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -7213,7 +7213,7 @@ func (ec *executionContext) _Mutation_createClip(ctx context.Context, field grap
|
|||||||
}()
|
}()
|
||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Mutation().CreateClip(rctx, fc.Args["title"].(string), fc.Args["video"].(graphql.Upload))
|
return ec.resolvers.Mutation().CreateClip(rctx, fc.Args["title"].(*string), fc.Args["video"].(graphql.Upload))
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ec.Error(ctx, err)
|
ec.Error(ctx, err)
|
||||||
|
|||||||
@ -289,7 +289,7 @@ type Mutation {
|
|||||||
followUser(followingId: Int!): FollowResult!
|
followUser(followingId: Int!): FollowResult!
|
||||||
unfollowUser(followingId: Int!): UnfollowResult!
|
unfollowUser(followingId: Int!): UnfollowResult!
|
||||||
markNotificationAsRead(notificationId: Int!): MarkNotificationReadResult!
|
markNotificationAsRead(notificationId: Int!): MarkNotificationReadResult!
|
||||||
createClip(title: String!, video: Upload!): Clip! # Создать клип
|
createClip(title: String, video: Upload!): Clip! # Создать клип
|
||||||
deleteClip(id: Int!): Boolean! # Удалить клип
|
deleteClip(id: Int!): Boolean! # Удалить клип
|
||||||
likeClip(clipId: Int!): ClipLike! # Лайкнуть клип
|
likeClip(clipId: Int!): ClipLike! # Лайкнуть клип
|
||||||
unlikeClip(clipId: Int!): Boolean! # Убрать лайк
|
unlikeClip(clipId: Int!): Boolean! # Убрать лайк
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user