mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Studio checksum from name. Default image
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
mutation StudioCreate(
|
mutation StudioCreate(
|
||||||
$name: String!,
|
$name: String!,
|
||||||
$url: String,
|
$url: String,
|
||||||
$image: String!) {
|
$image: String) {
|
||||||
|
|
||||||
studioCreate(input: { name: $name, url: $url, image: $image }) {
|
studioCreate(input: { name: $name, url: $url, image: $image }) {
|
||||||
...StudioData
|
...StudioData
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ input StudioCreateInput {
|
|||||||
name: String!
|
name: String!
|
||||||
url: String
|
url: String
|
||||||
"""This should be base64 encoded"""
|
"""This should be base64 encoded"""
|
||||||
image: String!
|
image: String
|
||||||
}
|
}
|
||||||
|
|
||||||
input StudioUpdateInput {
|
input StudioUpdateInput {
|
||||||
|
|||||||
@@ -12,8 +12,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (r *mutationResolver) StudioCreate(ctx context.Context, input models.StudioCreateInput) (*models.Studio, error) {
|
func (r *mutationResolver) StudioCreate(ctx context.Context, input models.StudioCreateInput) (*models.Studio, error) {
|
||||||
|
// generate checksum from studio name rather than image
|
||||||
|
checksum := utils.MD5FromString(input.Name)
|
||||||
|
|
||||||
|
var imageData []byte
|
||||||
|
var err error
|
||||||
|
|
||||||
|
if input.Image == nil {
|
||||||
|
input.Image = &models.DefaultStudioImage
|
||||||
|
}
|
||||||
|
|
||||||
// Process the base 64 encoded image string
|
// Process the base 64 encoded image string
|
||||||
checksum, imageData, err := utils.ProcessBase64Image(input.Image)
|
_, imageData, err = utils.ProcessBase64Image(*input.Image)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2235,7 +2235,7 @@ input StudioCreateInput {
|
|||||||
name: String!
|
name: String!
|
||||||
url: String
|
url: String
|
||||||
"""This should be base64 encoded"""
|
"""This should be base64 encoded"""
|
||||||
image: String!
|
image: String
|
||||||
}
|
}
|
||||||
|
|
||||||
input StudioUpdateInput {
|
input StudioUpdateInput {
|
||||||
@@ -8699,7 +8699,7 @@ func (ec *executionContext) unmarshalInputStudioCreateInput(ctx context.Context,
|
|||||||
}
|
}
|
||||||
case "image":
|
case "image":
|
||||||
var err error
|
var err error
|
||||||
it.Image, err = ec.unmarshalNString2string(ctx, v)
|
it.Image, err = ec.unmarshalOString2ᚖstring(ctx, v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ type StudioCreateInput struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
URL *string `json:"url"`
|
URL *string `json:"url"`
|
||||||
// This should be base64 encoded
|
// This should be base64 encoded
|
||||||
Image string `json:"image"`
|
Image *string `json:"image"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StudioDestroyInput struct {
|
type StudioDestroyInput struct {
|
||||||
|
|||||||
@@ -13,3 +13,5 @@ type Studio struct {
|
|||||||
CreatedAt SQLiteTimestamp `db:"created_at" json:"created_at"`
|
CreatedAt SQLiteTimestamp `db:"created_at" json:"created_at"`
|
||||||
UpdatedAt SQLiteTimestamp `db:"updated_at" json:"updated_at"`
|
UpdatedAt SQLiteTimestamp `db:"updated_at" json:"updated_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var DefaultStudioImage string = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4wgVBQsJl1CMZAAAASJJREFUeNrt3N0JwyAYhlEj3cj9R3Cm5rbkqtAP+qrnGaCYHPwJpLlaa++mmLpbAERAgAgIEAEBIiBABERAgAgIEAEBIiBABERAgAgIEAHZuVflj40x4i94zhk9vqsVvEq6AsQqMP1EjORx20OACAgQRRx7T+zzcFBxcjNDfoB4ntQqTm5Awo7MlqywZxcgYQ+RlqywJ3ozJAQCSBiEJSsQA0gYBpDAgAARECACAkRAgAgIEAERECACAmSjUv6eAOSB8m8YIGGzBUjYbAESBgMkbBkDEjZbgITBAClcxiqQvEoatreYIWEBASIgJ4Gkf11ntXH3nS9uxfGWfJ5J9hAgAgJEQAQEiIAAERAgAgJEQAQEiIAAERAgAgJEQAQEiL7qBuc6RKLHxr0CAAAAAElFTkSuQmCC"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
// Generated in 2019-08-20T18:32:35+10:00
|
// Generated in 2019-08-21T15:05:29+10:00
|
||||||
export type Maybe<T> = T | undefined;
|
export type Maybe<T> = T | undefined;
|
||||||
|
|
||||||
export interface SceneFilterType {
|
export interface SceneFilterType {
|
||||||
@@ -197,7 +197,7 @@ export interface StudioCreateInput {
|
|||||||
|
|
||||||
url?: Maybe<string>;
|
url?: Maybe<string>;
|
||||||
/** This should be base64 encoded */
|
/** This should be base64 encoded */
|
||||||
image: string;
|
image?: Maybe<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StudioUpdateInput {
|
export interface StudioUpdateInput {
|
||||||
@@ -411,7 +411,7 @@ export type SceneUpdateSceneUpdate = SceneDataFragment;
|
|||||||
export type StudioCreateVariables = {
|
export type StudioCreateVariables = {
|
||||||
name: string;
|
name: string;
|
||||||
url?: Maybe<string>;
|
url?: Maybe<string>;
|
||||||
image: string;
|
image?: Maybe<string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type StudioCreateMutation = {
|
export type StudioCreateMutation = {
|
||||||
@@ -1819,7 +1819,7 @@ export function useSceneUpdate(
|
|||||||
>(SceneUpdateDocument, baseOptions);
|
>(SceneUpdateDocument, baseOptions);
|
||||||
}
|
}
|
||||||
export const StudioCreateDocument = gql`
|
export const StudioCreateDocument = gql`
|
||||||
mutation StudioCreate($name: String!, $url: String, $image: String!) {
|
mutation StudioCreate($name: String!, $url: String, $image: String) {
|
||||||
studioCreate(input: { name: $name, url: $url, image: $image }) {
|
studioCreate(input: { name: $name, url: $url, image: $image }) {
|
||||||
...StudioData
|
...StudioData
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user