Skip to content

Commit 346abe1

Browse files
committed
feat: update project subpages
1 parent cab5f73 commit 346abe1

File tree

9 files changed

+244
-80
lines changed

9 files changed

+244
-80
lines changed

frontend/app/api/generated.ts

Lines changed: 144 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,12 +1502,52 @@ export type GetMeQueryVariables = Exact<{ [key: string]: never; }>;
15021502
export type GetMeQuery = { __typename?: 'Query', me: { __typename?: 'User', id: string, name: string, email: string, image?: string | null, membersId: string, gender: Gender, birthdate: string, church: { __typename?: 'Church', id: string, name: string, country: string, category: ChurchCategory }, roles: Array<{ __typename?: 'UserRole', id: string, role: RoleType, scope?: { __typename?: 'RoleScope', id: string, type: ScopeType, church?: { __typename?: 'Church', id: string } | null, team?: { __typename?: 'Team', id: string } | null, project?: { __typename?: 'Project', id: string } | null } | null }> } };
15031503

15041504
export type DeleteChallengeMutationVariables = Exact<{
1505-
challengeId: Scalars['ID']['input'];
1505+
id: Scalars['ID']['input'];
15061506
}>;
15071507

15081508

15091509
export type DeleteChallengeMutation = { __typename?: 'Mutation', deleteChallenge: boolean };
15101510

1511+
export type UpdateChallengeMutationVariables = Exact<{
1512+
id: Scalars['ID']['input'];
1513+
input: UpdateChallengeInput;
1514+
}>;
1515+
1516+
1517+
export type UpdateChallengeMutation = { __typename?: 'Mutation', updateChallenge: { __typename?: 'Challenge', id: string } };
1518+
1519+
export type CreateChallengeMutationVariables = Exact<{
1520+
projectId: Scalars['ID']['input'];
1521+
eventId: Scalars['ID']['input'];
1522+
input: CreateChallengeInput;
1523+
}>;
1524+
1525+
1526+
export type CreateChallengeMutation = { __typename?: 'Mutation', createChallenge: { __typename?: 'Challenge', id: string } };
1527+
1528+
export type DeleteEventMutationVariables = Exact<{
1529+
id: Scalars['ID']['input'];
1530+
}>;
1531+
1532+
1533+
export type DeleteEventMutation = { __typename?: 'Mutation', deleteEvent: boolean };
1534+
1535+
export type UpdateEventMutationVariables = Exact<{
1536+
id: Scalars['ID']['input'];
1537+
input: UpdateEventInput;
1538+
}>;
1539+
1540+
1541+
export type UpdateEventMutation = { __typename?: 'Mutation', updateEvent: { __typename?: 'Event', id: string } };
1542+
1543+
export type CreateEventMutationVariables = Exact<{
1544+
projectId: Scalars['ID']['input'];
1545+
input: CreateEventInput;
1546+
}>;
1547+
1548+
1549+
export type CreateEventMutation = { __typename?: 'Mutation', createEvent: { __typename?: 'Event', id: string } };
1550+
15111551
export type CreateProjectMutationVariables = Exact<{
15121552
input: CreateProjectInput;
15131553
}>;
@@ -1523,6 +1563,13 @@ export type UpdateProjectMutationVariables = Exact<{
15231563

15241564
export type UpdateProjectMutation = { __typename?: 'Mutation', updateProject: { __typename?: 'Project', id: string } };
15251565

1566+
export type DeleteProjectMutationVariables = Exact<{
1567+
id: Scalars['ID']['input'];
1568+
}>;
1569+
1570+
1571+
export type DeleteProjectMutation = { __typename?: 'Mutation', deleteProject: boolean };
1572+
15261573
export type AdminSidebarQueryVariables = Exact<{ [key: string]: never; }>;
15271574

15281575

@@ -1539,25 +1586,23 @@ export type AdminHomePageQueryVariables = Exact<{ [key: string]: never; }>;
15391586
export type AdminHomePageQuery = { __typename?: 'Query', me: { __typename?: 'User', id: string, name: string }, projects: { __typename?: 'ProjectConnection', edges: Array<{ __typename?: 'ProjectEdge', node: { __typename?: 'Project', id: string, name: string, description: string, endDate: any, startDate: any, branding: { __typename?: 'Branding', logo?: string | null, rounding: number, colors: { __typename?: 'Colors', primary: string, secondary: string, tertiary: string } } } }> } };
15401587

15411588
export type AdminProjectAchievementPageQueryVariables = Exact<{
1542-
projectId: Scalars['ID']['input'];
15431589
achievementId: Scalars['ID']['input'];
15441590
}>;
15451591

15461592

15471593
export type AdminProjectAchievementPageQuery = { __typename?: 'Query', achievement:
1548-
| { __typename?: 'ListeningAchievement', id: string, name: string, description: string }
1549-
| { __typename?: 'ReadingAchievement', id: string, name: string, description: string }
1550-
| { __typename?: 'SimpleAchievement', id: string, name: string, description: string }
1551-
| { __typename?: 'StreakAchievement', id: string, name: string, description: string }
1552-
, project: { __typename?: 'Project', id: string, name: string } };
1594+
| { __typename?: 'ListeningAchievement', id: string, name: string, description: string, image?: string | null, achievedAt?: any | null, points: number, hidden: boolean, project: { __typename?: 'Project', id: string, name: string } }
1595+
| { __typename?: 'ReadingAchievement', id: string, name: string, description: string, image?: string | null, achievedAt?: any | null, points: number, hidden: boolean, project: { __typename?: 'Project', id: string, name: string } }
1596+
| { __typename?: 'SimpleAchievement', id: string, name: string, description: string, image?: string | null, achievedAt?: any | null, points: number, hidden: boolean, project: { __typename?: 'Project', id: string, name: string } }
1597+
| { __typename?: 'StreakAchievement', id: string, name: string, description: string, image?: string | null, achievedAt?: any | null, points: number, hidden: boolean, project: { __typename?: 'Project', id: string, name: string } }
1598+
};
15531599

15541600
export type AdminProjectChallengePageQueryVariables = Exact<{
1555-
projectId: Scalars['ID']['input'];
15561601
challengeId: Scalars['ID']['input'];
15571602
}>;
15581603

15591604

1560-
export type AdminProjectChallengePageQuery = { __typename?: 'Query', challenge: { __typename?: 'Challenge', id: string, name: string, description: any, image?: string | null, url?: string | null, buttonText: string, publishedAt: any, endTime?: any | null }, project: { __typename?: 'Project', id: string, name: string } };
1605+
export type AdminProjectChallengePageQuery = { __typename?: 'Query', challenge: { __typename?: 'Challenge', id: string, name: string, description: any, image?: string | null, url?: string | null, buttonText: string, publishedAt: any, endTime?: any | null, project: { __typename?: 'Project', id: string, name: string } } };
15611606

15621607
export type AdminProjectEditPageQueryVariables = Exact<{
15631608
projectId: Scalars['ID']['input'];
@@ -1567,12 +1612,11 @@ export type AdminProjectEditPageQueryVariables = Exact<{
15671612
export type AdminProjectEditPageQuery = { __typename?: 'Query', project: { __typename?: 'Project', id: string, name: string, description: string, startDate: any, endDate: any, archivedAt?: boolean | null, branding: { __typename?: 'Branding', logo?: string | null, rounding: number, colors: { __typename?: 'Colors', primary: string } } } };
15681613

15691614
export type AdminProjectEventPageQueryVariables = Exact<{
1570-
projectId: Scalars['ID']['input'];
15711615
eventId: Scalars['ID']['input'];
15721616
}>;
15731617

15741618

1575-
export type AdminProjectEventPageQuery = { __typename?: 'Query', event: { __typename?: 'Event', id: string, name: string, description: string }, project: { __typename?: 'Project', id: string, name: string } };
1619+
export type AdminProjectEventPageQuery = { __typename?: 'Query', event: { __typename?: 'Event', id: string, name: string, description: string, parentProject: { __typename?: 'Project', id: string, name: string } } };
15761620

15771621
export type AdminProjectPageQueryVariables = Exact<{
15781622
projectId: Scalars['ID']['input'];
@@ -1587,12 +1631,11 @@ export type AdminProjectPageQuery = { __typename?: 'Query', project: { __typenam
15871631
}> }, events: { __typename?: 'EventConnection', edges: Array<{ __typename?: 'EventEdge', node: { __typename?: 'Event', id: string, name: string } }> }, challenges: { __typename?: 'ChallengeConnection', edges: Array<{ __typename?: 'ChallengeEdge', node: { __typename?: 'Challenge', id: string, name: string } }> }, streaks: { __typename?: 'StreakConnection', edges: Array<{ __typename?: 'StreakEdge', node: { __typename?: 'Streak', id: string, name: string } }> } };
15881632

15891633
export type AdminProjectStreakPageQueryVariables = Exact<{
1590-
projectId: Scalars['ID']['input'];
15911634
streakId: Scalars['ID']['input'];
15921635
}>;
15931636

15941637

1595-
export type AdminProjectStreakPageQuery = { __typename?: 'Query', streak: { __typename?: 'Streak', id: string, name: string, description: string, status: number, relevantDays: Array<{ __typename?: 'DateRange', start: any, end: any }> }, project: { __typename?: 'Project', id: string, name: string } };
1638+
export type AdminProjectStreakPageQuery = { __typename?: 'Query', streak: { __typename?: 'Streak', id: string, name: string, description: string, status: number, relevantDays: Array<{ __typename?: 'DateRange', start: any, end: any }>, project: { __typename?: 'Project', id: string, name: string } } };
15961639

15971640
export type AdminProjectsPageQueryVariables = Exact<{ [key: string]: never; }>;
15981641

@@ -1687,14 +1730,67 @@ export function useGetMeQuery(options?: Omit<Urql.UseQueryArgs<never, GetMeQuery
16871730
return Urql.useQuery<GetMeQuery, GetMeQueryVariables | undefined>({ query: GetMeDocument, variables: undefined, ...options });
16881731
};
16891732
export const DeleteChallengeDocument = gql`
1690-
mutation DeleteChallenge($challengeId: ID!) {
1691-
deleteChallenge(id: $challengeId)
1733+
mutation DeleteChallenge($id: ID!) {
1734+
deleteChallenge(id: $id)
16921735
}
16931736
`;
16941737

16951738
export function useDeleteChallengeMutation() {
16961739
return Urql.useMutation<DeleteChallengeMutation, DeleteChallengeMutationVariables>(DeleteChallengeDocument);
16971740
};
1741+
export const UpdateChallengeDocument = gql`
1742+
mutation UpdateChallenge($id: ID!, $input: UpdateChallengeInput!) {
1743+
updateChallenge(id: $id, input: $input) {
1744+
id
1745+
}
1746+
}
1747+
`;
1748+
1749+
export function useUpdateChallengeMutation() {
1750+
return Urql.useMutation<UpdateChallengeMutation, UpdateChallengeMutationVariables>(UpdateChallengeDocument);
1751+
};
1752+
export const CreateChallengeDocument = gql`
1753+
mutation CreateChallenge($projectId: ID!, $eventId: ID!, $input: CreateChallengeInput!) {
1754+
createChallenge(projectId: $projectId, eventId: $eventId, input: $input) {
1755+
id
1756+
}
1757+
}
1758+
`;
1759+
1760+
export function useCreateChallengeMutation() {
1761+
return Urql.useMutation<CreateChallengeMutation, CreateChallengeMutationVariables>(CreateChallengeDocument);
1762+
};
1763+
export const DeleteEventDocument = gql`
1764+
mutation DeleteEvent($id: ID!) {
1765+
deleteEvent(id: $id)
1766+
}
1767+
`;
1768+
1769+
export function useDeleteEventMutation() {
1770+
return Urql.useMutation<DeleteEventMutation, DeleteEventMutationVariables>(DeleteEventDocument);
1771+
};
1772+
export const UpdateEventDocument = gql`
1773+
mutation UpdateEvent($id: ID!, $input: UpdateEventInput!) {
1774+
updateEvent(id: $id, input: $input) {
1775+
id
1776+
}
1777+
}
1778+
`;
1779+
1780+
export function useUpdateEventMutation() {
1781+
return Urql.useMutation<UpdateEventMutation, UpdateEventMutationVariables>(UpdateEventDocument);
1782+
};
1783+
export const CreateEventDocument = gql`
1784+
mutation CreateEvent($projectId: ID!, $input: CreateEventInput!) {
1785+
createEvent(projectId: $projectId, input: $input) {
1786+
id
1787+
}
1788+
}
1789+
`;
1790+
1791+
export function useCreateEventMutation() {
1792+
return Urql.useMutation<CreateEventMutation, CreateEventMutationVariables>(CreateEventDocument);
1793+
};
16981794
export const CreateProjectDocument = gql`
16991795
mutation CreateProject($input: CreateProjectInput!) {
17001796
createProject(input: $input) {
@@ -1717,6 +1813,15 @@ export const UpdateProjectDocument = gql`
17171813
export function useUpdateProjectMutation() {
17181814
return Urql.useMutation<UpdateProjectMutation, UpdateProjectMutationVariables>(UpdateProjectDocument);
17191815
};
1816+
export const DeleteProjectDocument = gql`
1817+
mutation DeleteProject($id: ID!) {
1818+
deleteProject(id: $id)
1819+
}
1820+
`;
1821+
1822+
export function useDeleteProjectMutation() {
1823+
return Urql.useMutation<DeleteProjectMutation, DeleteProjectMutationVariables>(DeleteProjectDocument);
1824+
};
17201825
export const AdminSidebarDocument = gql`
17211826
query AdminSidebar {
17221827
projects {
@@ -1785,15 +1890,19 @@ export function useAdminHomePageQuery(options?: Omit<Urql.UseQueryArgs<never, Ad
17851890
return Urql.useQuery<AdminHomePageQuery, AdminHomePageQueryVariables | undefined>({ query: AdminHomePageDocument, variables: undefined, ...options });
17861891
};
17871892
export const AdminProjectAchievementPageDocument = gql`
1788-
query AdminProjectAchievementPage($projectId: ID!, $achievementId: ID!) {
1893+
query AdminProjectAchievementPage($achievementId: ID!) {
17891894
achievement(id: $achievementId) {
17901895
id
17911896
name
17921897
description
1793-
}
1794-
project(id: $projectId) {
1795-
id
1796-
name
1898+
image
1899+
achievedAt
1900+
points
1901+
hidden
1902+
project {
1903+
id
1904+
name
1905+
}
17971906
}
17981907
}
17991908
`;
@@ -1802,7 +1911,7 @@ export function useAdminProjectAchievementPageQuery(options?: Omit<Urql.UseQuery
18021911
return Urql.useQuery<AdminProjectAchievementPageQuery, AdminProjectAchievementPageQueryVariables | undefined>({ query: AdminProjectAchievementPageDocument, variables: undefined, ...options });
18031912
};
18041913
export const AdminProjectChallengePageDocument = gql`
1805-
query AdminProjectChallengePage($projectId: ID!, $challengeId: ID!) {
1914+
query AdminProjectChallengePage($challengeId: ID!) {
18061915
challenge(id: $challengeId) {
18071916
id
18081917
name
@@ -1812,10 +1921,10 @@ export const AdminProjectChallengePageDocument = gql`
18121921
buttonText
18131922
publishedAt
18141923
endTime
1815-
}
1816-
project(id: $projectId) {
1817-
id
1818-
name
1924+
project {
1925+
id
1926+
name
1927+
}
18191928
}
18201929
}
18211930
`;
@@ -1847,15 +1956,15 @@ export function useAdminProjectEditPageQuery(options?: Omit<Urql.UseQueryArgs<ne
18471956
return Urql.useQuery<AdminProjectEditPageQuery, AdminProjectEditPageQueryVariables | undefined>({ query: AdminProjectEditPageDocument, variables: undefined, ...options });
18481957
};
18491958
export const AdminProjectEventPageDocument = gql`
1850-
query AdminProjectEventPage($projectId: ID!, $eventId: ID!) {
1959+
query AdminProjectEventPage($eventId: ID!) {
18511960
event(id: $eventId) {
18521961
id
18531962
name
18541963
description
1855-
}
1856-
project(id: $projectId) {
1857-
id
1858-
name
1964+
parentProject {
1965+
id
1966+
name
1967+
}
18591968
}
18601969
}
18611970
`;
@@ -1918,7 +2027,7 @@ export function useAdminProjectPageQuery(options?: Omit<Urql.UseQueryArgs<never,
19182027
return Urql.useQuery<AdminProjectPageQuery, AdminProjectPageQueryVariables | undefined>({ query: AdminProjectPageDocument, variables: undefined, ...options });
19192028
};
19202029
export const AdminProjectStreakPageDocument = gql`
1921-
query AdminProjectStreakPage($projectId: ID!, $streakId: ID!) {
2030+
query AdminProjectStreakPage($streakId: ID!) {
19222031
streak(id: $streakId) {
19232032
id
19242033
name
@@ -1928,10 +2037,10 @@ export const AdminProjectStreakPageDocument = gql`
19282037
start
19292038
end
19302039
}
1931-
}
1932-
project(id: $projectId) {
1933-
id
1934-
name
2040+
project {
2041+
id
2042+
name
2043+
}
19352044
}
19362045
}
19372046
`;
Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1-
mutation DeleteChallenge($challengeId: ID!) {
2-
deleteChallenge(id: $challengeId)
1+
mutation DeleteChallenge($id: ID!) {
2+
deleteChallenge(id: $id)
3+
}
4+
5+
mutation UpdateChallenge($id: ID!, $input: UpdateChallengeInput!) {
6+
updateChallenge(id: $id, input: $input) {
7+
id
8+
}
9+
}
10+
11+
mutation CreateChallenge(
12+
$projectId: ID!
13+
$eventId: ID!
14+
$input: CreateChallengeInput!
15+
) {
16+
createChallenge(projectId: $projectId, eventId: $eventId, input: $input) {
17+
id
18+
}
319
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
mutation DeleteEvent($id: ID!) {
2+
deleteEvent(id: $id)
3+
}
4+
5+
mutation UpdateEvent($id: ID!, $input: UpdateEventInput!) {
6+
updateEvent(id: $id, input: $input) {
7+
id
8+
}
9+
}
10+
11+
mutation CreateEvent($projectId: ID!, $input: CreateEventInput!) {
12+
createEvent(projectId: $projectId, input: $input) {
13+
id
14+
}
15+
}

frontend/app/graphql/mutations/projects.gql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ mutation UpdateProject($id: ID!, $input: UpdateProjectInput!) {
99
id
1010
}
1111
}
12+
13+
mutation DeleteProject($id: ID!) {
14+
deleteProject(id: $id)
15+
}

frontend/app/pages/admin/projects/[projectId]/achievements/[achievementId].vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ definePageMeta({
55
})
66
77
gql(`
8-
query AdminProjectAchievementPage($projectId: ID!, $achievementId: ID!) {
8+
query AdminProjectAchievementPage($achievementId: ID!) {
99
achievement(id: $achievementId) {
1010
id
1111
name
1212
description
13-
}
14-
project(id: $projectId) {
15-
id
16-
name
13+
image
14+
achievedAt
15+
points
16+
hidden
17+
project {
18+
id
19+
name
20+
}
1721
}
1822
}
1923
`)
@@ -23,7 +27,6 @@ const route = useRoute('admin-projects-projectId-achievements-achievementId')
2327
const { isAuthReady } = useAuthReady()
2428
const { data, fetching, error } = useAdminProjectAchievementPageQuery({
2529
variables: {
26-
projectId: route.params.projectId,
2730
achievementId: route.params.achievementId,
2831
},
2932
pause: computed(() => !isAuthReady.value),
@@ -41,7 +44,7 @@ const { data, fetching, error } = useAdminProjectAchievementPageQuery({
4144
to: { name: 'admin-projects' },
4245
},
4346
{
44-
label: data?.project.name ?? route.params.projectId,
47+
label: data?.achievement.project.name ?? route.params.projectId,
4548
to: {
4649
name: 'admin-projects-projectId',
4750
params: { projectId: route.params.projectId },

0 commit comments

Comments
 (0)