2021-01-18 01:23:20 +00:00
|
|
|
package models
|
|
|
|
|
2022-07-13 06:30:54 +00:00
|
|
|
type StashID struct {
|
|
|
|
StashID string `db:"stash_id" json:"stash_id"`
|
|
|
|
Endpoint string `db:"endpoint" json:"endpoint"`
|
2022-04-25 05:55:05 +00:00
|
|
|
}
|
|
|
|
|
2022-07-13 06:30:54 +00:00
|
|
|
type UpdateStashIDs struct {
|
|
|
|
StashIDs []StashID `json:"stash_ids"`
|
|
|
|
Mode RelationshipUpdateMode `json:"mode"`
|
2021-01-18 01:23:20 +00:00
|
|
|
}
|
2022-11-14 05:35:09 +00:00
|
|
|
|
|
|
|
// AddUnique adds the stash id to the list, only if the endpoint/stashid pair does not already exist in the list.
|
|
|
|
func (u *UpdateStashIDs) AddUnique(v StashID) {
|
|
|
|
for _, vv := range u.StashIDs {
|
|
|
|
if vv.StashID == v.StashID && vv.Endpoint == v.Endpoint {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
u.StashIDs = append(u.StashIDs, v)
|
|
|
|
}
|
2022-11-16 23:08:15 +00:00
|
|
|
|
|
|
|
type StashIDCriterionInput struct {
|
|
|
|
// If present, this value is treated as a predicate.
|
|
|
|
// That is, it will filter based on stash_ids with the matching endpoint
|
|
|
|
Endpoint *string `json:"endpoint"`
|
|
|
|
StashID *string `json:"stash_id"`
|
|
|
|
Modifier CriterionModifier `json:"modifier"`
|
|
|
|
}
|