mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Add CreatedAt & UpdatedAt to all object resolvers (#1421)
* add `CreatedAt` & `UpdatedAt` to all objects * add `FileModTime` to supported objects * Use `GQL.SlimTagDataFragment` over `GQL.Tag`
This commit is contained in:
@@ -9,6 +9,10 @@ type Gallery {
|
|||||||
details: String
|
details: String
|
||||||
rating: Int
|
rating: Int
|
||||||
organized: Boolean!
|
organized: Boolean!
|
||||||
|
created_at: Time!
|
||||||
|
updated_at: Time!
|
||||||
|
file_mod_time: Time
|
||||||
|
|
||||||
scenes: [Scene!]!
|
scenes: [Scene!]!
|
||||||
studio: Studio
|
studio: Studio
|
||||||
image_count: Int!
|
image_count: Int!
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ type Image {
|
|||||||
o_counter: Int
|
o_counter: Int
|
||||||
organized: Boolean!
|
organized: Boolean!
|
||||||
path: String!
|
path: String!
|
||||||
|
created_at: Time!
|
||||||
|
updated_at: Time!
|
||||||
|
file_mod_time: Time
|
||||||
|
|
||||||
file: ImageFileType! # Resolver
|
file: ImageFileType! # Resolver
|
||||||
paths: ImagePathsType! # Resolver
|
paths: ImagePathsType! # Resolver
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ type Movie {
|
|||||||
director: String
|
director: String
|
||||||
synopsis: String
|
synopsis: String
|
||||||
url: String
|
url: String
|
||||||
|
created_at: Time!
|
||||||
|
updated_at: Time!
|
||||||
|
|
||||||
front_image_path: String # Resolver
|
front_image_path: String # Resolver
|
||||||
back_image_path: String # Resolver
|
back_image_path: String # Resolver
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ type Performer {
|
|||||||
death_date: String
|
death_date: String
|
||||||
hair_color: String
|
hair_color: String
|
||||||
weight: Int
|
weight: Int
|
||||||
|
created_at: Time!
|
||||||
|
updated_at: Time!
|
||||||
}
|
}
|
||||||
|
|
||||||
input PerformerCreateInput {
|
input PerformerCreateInput {
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ type SceneMarker {
|
|||||||
seconds: Float!
|
seconds: Float!
|
||||||
primary_tag: Tag!
|
primary_tag: Tag!
|
||||||
tags: [Tag!]!
|
tags: [Tag!]!
|
||||||
|
created_at: Time!
|
||||||
|
updated_at: Time!
|
||||||
|
|
||||||
"""The path to stream this marker"""
|
"""The path to stream this marker"""
|
||||||
stream: String! # Resolver
|
stream: String! # Resolver
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ type Scene {
|
|||||||
path: String!
|
path: String!
|
||||||
phash: String
|
phash: String
|
||||||
interactive: Boolean!
|
interactive: Boolean!
|
||||||
|
created_at: Time!
|
||||||
|
updated_at: Time!
|
||||||
|
file_mod_time: Time
|
||||||
|
|
||||||
file: SceneFileType! # Resolver
|
file: SceneFileType! # Resolver
|
||||||
paths: ScenePathsType! # Resolver
|
paths: ScenePathsType! # Resolver
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ type Studio {
|
|||||||
stash_ids: [StashID!]!
|
stash_ids: [StashID!]!
|
||||||
rating: Int
|
rating: Int
|
||||||
details: String
|
details: String
|
||||||
|
created_at: Time!
|
||||||
|
updated_at: Time!
|
||||||
}
|
}
|
||||||
|
|
||||||
input StudioCreateInput {
|
input StudioCreateInput {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
type Tag {
|
type Tag {
|
||||||
id: ID!
|
id: ID!
|
||||||
name: String!
|
name: String!
|
||||||
|
created_at: Time!
|
||||||
|
updated_at: Time!
|
||||||
|
|
||||||
image_path: String # Resolver
|
image_path: String # Resolver
|
||||||
scene_count: Int # Resolver
|
scene_count: Int # Resolver
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stashapp/stash/pkg/image"
|
"github.com/stashapp/stash/pkg/image"
|
||||||
"github.com/stashapp/stash/pkg/models"
|
"github.com/stashapp/stash/pkg/models"
|
||||||
@@ -153,3 +154,15 @@ func (r *galleryResolver) ImageCount(ctx context.Context, obj *models.Gallery) (
|
|||||||
|
|
||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *galleryResolver) CreatedAt(ctx context.Context, obj *models.Gallery) (*time.Time, error) {
|
||||||
|
return &obj.CreatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *galleryResolver) UpdatedAt(ctx context.Context, obj *models.Gallery) (*time.Time, error) {
|
||||||
|
return &obj.UpdatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *galleryResolver) FileModTime(ctx context.Context, obj *models.Gallery) (*time.Time, error) {
|
||||||
|
return &obj.FileModTime.Timestamp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
||||||
"github.com/stashapp/stash/pkg/image"
|
"github.com/stashapp/stash/pkg/image"
|
||||||
@@ -91,3 +92,15 @@ func (r *imageResolver) Performers(ctx context.Context, obj *models.Image) (ret
|
|||||||
|
|
||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *imageResolver) CreatedAt(ctx context.Context, obj *models.Image) (*time.Time, error) {
|
||||||
|
return &obj.CreatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *imageResolver) UpdatedAt(ctx context.Context, obj *models.Image) (*time.Time, error) {
|
||||||
|
return &obj.UpdatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *imageResolver) FileModTime(ctx context.Context, obj *models.Image) (*time.Time, error) {
|
||||||
|
return &obj.FileModTime.Timestamp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
||||||
"github.com/stashapp/stash/pkg/models"
|
"github.com/stashapp/stash/pkg/models"
|
||||||
@@ -123,3 +124,11 @@ func (r *movieResolver) SceneCount(ctx context.Context, obj *models.Movie) (ret
|
|||||||
|
|
||||||
return &res, err
|
return &res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *movieResolver) CreatedAt(ctx context.Context, obj *models.Movie) (*time.Time, error) {
|
||||||
|
return &obj.CreatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *movieResolver) UpdatedAt(ctx context.Context, obj *models.Movie) (*time.Time, error) {
|
||||||
|
return &obj.UpdatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
||||||
"github.com/stashapp/stash/pkg/gallery"
|
"github.com/stashapp/stash/pkg/gallery"
|
||||||
@@ -245,3 +246,11 @@ func (r *performerResolver) Weight(ctx context.Context, obj *models.Performer) (
|
|||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *performerResolver) CreatedAt(ctx context.Context, obj *models.Performer) (*time.Time, error) {
|
||||||
|
return &obj.CreatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *performerResolver) UpdatedAt(ctx context.Context, obj *models.Performer) (*time.Time, error) {
|
||||||
|
return &obj.UpdatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
||||||
"github.com/stashapp/stash/pkg/manager/config"
|
"github.com/stashapp/stash/pkg/manager/config"
|
||||||
@@ -215,3 +216,15 @@ func (r *sceneResolver) Phash(ctx context.Context, obj *models.Scene) (*string,
|
|||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *sceneResolver) CreatedAt(ctx context.Context, obj *models.Scene) (*time.Time, error) {
|
||||||
|
return &obj.CreatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *sceneResolver) UpdatedAt(ctx context.Context, obj *models.Scene) (*time.Time, error) {
|
||||||
|
return &obj.UpdatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *sceneResolver) FileModTime(ctx context.Context, obj *models.Scene) (*time.Time, error) {
|
||||||
|
return &obj.FileModTime.Timestamp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
||||||
"github.com/stashapp/stash/pkg/models"
|
"github.com/stashapp/stash/pkg/models"
|
||||||
@@ -56,3 +57,11 @@ func (r *sceneMarkerResolver) Preview(ctx context.Context, obj *models.SceneMark
|
|||||||
sceneID := int(obj.SceneID.Int64)
|
sceneID := int(obj.SceneID.Int64)
|
||||||
return urlbuilders.NewSceneURLBuilder(baseURL, sceneID).GetSceneMarkerStreamPreviewURL(obj.ID), nil
|
return urlbuilders.NewSceneURLBuilder(baseURL, sceneID).GetSceneMarkerStreamPreviewURL(obj.ID), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *sceneMarkerResolver) CreatedAt(ctx context.Context, obj *models.SceneMarker) (*time.Time, error) {
|
||||||
|
return &obj.CreatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *sceneMarkerResolver) UpdatedAt(ctx context.Context, obj *models.SceneMarker) (*time.Time, error) {
|
||||||
|
return &obj.UpdatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
||||||
"github.com/stashapp/stash/pkg/gallery"
|
"github.com/stashapp/stash/pkg/gallery"
|
||||||
@@ -131,3 +132,11 @@ func (r *studioResolver) Details(ctx context.Context, obj *models.Studio) (*stri
|
|||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *studioResolver) CreatedAt(ctx context.Context, obj *models.Studio) (*time.Time, error) {
|
||||||
|
return &obj.CreatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *studioResolver) UpdatedAt(ctx context.Context, obj *models.Studio) (*time.Time, error) {
|
||||||
|
return &obj.UpdatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
||||||
"github.com/stashapp/stash/pkg/gallery"
|
"github.com/stashapp/stash/pkg/gallery"
|
||||||
@@ -74,3 +75,11 @@ func (r *tagResolver) ImagePath(ctx context.Context, obj *models.Tag) (*string,
|
|||||||
imagePath := urlbuilders.NewTagURLBuilder(baseURL, obj).GetTagImageURL()
|
imagePath := urlbuilders.NewTagURLBuilder(baseURL, obj).GetTagImageURL()
|
||||||
return &imagePath, nil
|
return &imagePath, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *tagResolver) CreatedAt(ctx context.Context, obj *models.Tag) (*time.Time, error) {
|
||||||
|
return &obj.CreatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *tagResolver) UpdatedAt(ctx context.Context, obj *models.Tag) (*time.Time, error) {
|
||||||
|
return &obj.UpdatedAt.Timestamp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Added [DLNA server](/settings?tab=dlna). ([#1364](https://github.com/stashapp/stash/pull/1364))
|
* Added [DLNA server](/settings?tab=dlna). ([#1364](https://github.com/stashapp/stash/pull/1364))
|
||||||
|
|
||||||
### 🎨 Improvements
|
### 🎨 Improvements
|
||||||
|
* Add `CreatedAt` and `UpdatedAt` (and `FileModTime` where applicable) to API objects.
|
||||||
* Add Studios Performer filter criterion. ([#1405](https://github.com/stashapp/stash/pull/1405))
|
* Add Studios Performer filter criterion. ([#1405](https://github.com/stashapp/stash/pull/1405))
|
||||||
* Add `subtractDays` post-process scraper action. ([#1399](https://github.com/stashapp/stash/pull/1399))
|
* Add `subtractDays` post-process scraper action. ([#1399](https://github.com/stashapp/stash/pull/1399))
|
||||||
* Skip scanning directories if path matches image and video exclude patterns. ([#1382](https://github.com/stashapp/stash/pull/1382))
|
* Skip scanning directories if path matches image and video exclude patterns. ([#1382](https://github.com/stashapp/stash/pull/1382))
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export const PrimaryTags: React.FC<IPrimaryTags> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
if (!sceneMarkers?.length) return <div />;
|
if (!sceneMarkers?.length) return <div />;
|
||||||
|
|
||||||
const primaries: Record<string, GQL.Tag> = {};
|
const primaries: Record<string, GQL.SlimTagDataFragment> = {};
|
||||||
const primaryTags: Record<string, GQL.SceneMarkerDataFragment[]> = {};
|
const primaryTags: Record<string, GQL.SceneMarkerDataFragment[]> = {};
|
||||||
sceneMarkers.forEach((m) => {
|
sceneMarkers.forEach((m) => {
|
||||||
if (primaryTags[m.primary_tag.id]) primaryTags[m.primary_tag.id].push(m);
|
if (primaryTags[m.primary_tag.id]) primaryTags[m.primary_tag.id].push(m);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ interface ISceneListTableProps {
|
|||||||
export const SceneListTable: React.FC<ISceneListTableProps> = (
|
export const SceneListTable: React.FC<ISceneListTableProps> = (
|
||||||
props: ISceneListTableProps
|
props: ISceneListTableProps
|
||||||
) => {
|
) => {
|
||||||
const renderTags = (tags: GQL.Tag[]) =>
|
const renderTags = (tags: GQL.SlimTagDataFragment[]) =>
|
||||||
tags.map((tag) => (
|
tags.map((tag) => (
|
||||||
<Link key={tag.id} to={NavUtils.makeTagScenesUrl(tag)}>
|
<Link key={tag.id} to={NavUtils.makeTagScenesUrl(tag)}>
|
||||||
<h6>{tag.name}</h6>
|
<h6>{tag.name}</h6>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { FilterSelect } from "./Select";
|
|||||||
|
|
||||||
type ValidTypes =
|
type ValidTypes =
|
||||||
| GQL.SlimPerformerDataFragment
|
| GQL.SlimPerformerDataFragment
|
||||||
| GQL.Tag
|
| GQL.SlimTagDataFragment
|
||||||
| GQL.SlimStudioDataFragment
|
| GQL.SlimStudioDataFragment
|
||||||
| GQL.SlimMovieDataFragment;
|
| GQL.SlimMovieDataFragment;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { TextUtils } from "src/utils";
|
|||||||
|
|
||||||
export type ValidTypes =
|
export type ValidTypes =
|
||||||
| GQL.SlimPerformerDataFragment
|
| GQL.SlimPerformerDataFragment
|
||||||
| GQL.Tag
|
| GQL.SlimTagDataFragment
|
||||||
| GQL.SlimStudioDataFragment
|
| GQL.SlimStudioDataFragment
|
||||||
| GQL.SlimMovieDataFragment;
|
| GQL.SlimMovieDataFragment;
|
||||||
type Option = { value: string; label: string };
|
type Option = { value: string; label: string };
|
||||||
|
|||||||
Reference in New Issue
Block a user