Skip to content

Commit 01480e7

Browse files
committed
feat: delete title mutation added
1 parent f057e72 commit 01480e7

2 files changed

Lines changed: 52 additions & 22 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
use serde::Deserialize;
2+
use serde::Serialize;
3+
use thoth_api::model::locale::LocaleCode;
4+
use thoth_api::model::title::Title;
5+
use uuid::Uuid;
6+
7+
const DELETE_TITLE_MUTATION: &str = "
8+
mutation DeleteTitle(
9+
$titleId: Uuid!
10+
) {
11+
deleteTitle(data: {
12+
titleId: $Uuid!
13+
}){
14+
titleId
15+
workId
16+
localeCode
17+
fullTitle
18+
title
19+
subtitle
20+
canonical
21+
}
22+
}
23+
";
24+
25+
graphql_query_builder! {
26+
DeleteTitleRequest,
27+
DeleteTitleRequestBody,
28+
Variables,
29+
DELETE_TITLE_MUTATION,
30+
DeleteTitleResponseBody,
31+
DeleteTitleResponseData,
32+
PushDeleteTitle,
33+
PushActionDeleteTitle
34+
}
35+
36+
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
37+
#[serde(rename_all = "camelCase")]
38+
pub struct Variables {
39+
pub title_id: Uuid,
40+
}
41+
42+
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
43+
#[serde(rename_all = "camelCase")]
44+
pub struct DeleteTitleResponseData {
45+
pub delete_title: Option<Title>,
46+
}

thoth-app/src/models/title/mod.rs

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,20 @@
11
use serde::Deserialize;
22
use serde::Serialize;
3-
use thoth_api::model::language::LanguageCode;
3+
use thoth_api::model::locale::LocaleCode;
44
use thoth_api::model::language::LanguageRelation;
55

66
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
77
#[serde(rename_all = "camelCase")]
8-
pub struct LanguageCodeDefinition {
9-
pub enum_values: Vec<LanguageCodeValues>,
8+
pub struct LocaleCodeDefinition {
9+
pub enum_values: Vec<LocaleCodeValues>,
1010
}
1111

1212
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
1313
#[serde(rename_all = "camelCase")]
14-
pub struct LanguageCodeValues {
15-
pub name: LanguageCode,
16-
}
17-
18-
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
19-
#[serde(rename_all = "camelCase")]
20-
pub struct LanguageRelationDefinition {
21-
pub enum_values: Vec<LanguageRelationValues>,
22-
}
23-
24-
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
25-
#[serde(rename_all = "camelCase")]
26-
pub struct LanguageRelationValues {
27-
pub name: LanguageRelation,
14+
pub struct LocaleCodeValues {
15+
pub name: LocaleCode,
2816
}
2917

3018
pub mod create_title_mutation;
19+
pub mod delete_title_mutation;
3120
pub mod update_title_mutation;
32-
33-
34-
// pub mod delete_language_mutation;
35-
// pub mod language_codes_query;
36-
// pub mod language_relations_query;

0 commit comments

Comments
 (0)