-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add minimal gui that lists proposals
- Loading branch information
Showing
18 changed files
with
1,202 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export default defineAppConfig({ | ||
mafiasi: { | ||
openidScopes: "openid" | ||
openidScopes: "openid profile" | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<script lang="ts" setup> | ||
import type {AG, MediumViewset} from "~/utils/apiClient"; | ||
definePageMeta({ | ||
name: "ag_index", | ||
middleware: ["authenticated"], | ||
}) | ||
const route = useRoute(); | ||
const agApi = await useAgApi(); | ||
const mediumApi = await useMediumApi(); | ||
const ag = ref<AG | null>(null); | ||
const proposals = ref<MediumViewset[]>([]); | ||
onMounted(async () => { | ||
ag.value = await agApi.agsRetrieve({ | ||
id: route.params.id as string | ||
}) | ||
proposals.value = await Promise.all( | ||
ag.value.openProposals.map((id) => mediumApi.mediumsRetrieve({ | ||
id: id, | ||
})) | ||
) | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div v-if="ag !== null"> | ||
<h1>{{ ag.name }}</h1> | ||
<h2>Proposals</h2> | ||
<ul> | ||
<li v-for="proposal in proposals">{{ proposal.name }} (proposed by {{ proposal.proposal.proposedBy }})</li> | ||
</ul> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
<script lang="ts" setup> | ||
import {useAgApi} from "~/composables/api"; | ||
import type {AG} from "~/utils/apiClient"; | ||
definePageMeta({ | ||
name: "index" | ||
name: "index", | ||
middleware: ["authenticated"], | ||
}) | ||
useSeoMeta({ | ||
title: "Mafiasi Kulturgenießer" | ||
}) | ||
const agApi = await useAgApi(); | ||
const ags = ref<AG[]>([]); | ||
onMounted(async () => { | ||
ags.value = await agApi.agsList(); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<h1 class="text-xl">Congratulations, you've got a Mafiasi App up and running</h1> | ||
<ul> | ||
<li v-for="ag in ags"> | ||
<NuxtLink :to="{ name: 'ag_index', params: { id: ag.id } }">{{ ag.name }}</NuxtLink> | ||
</li> | ||
</ul> | ||
</div> | ||
</template> |
23 changes: 23 additions & 0 deletions
23
src/mafiasi_kultur_gui/utils/apiClient/.openapi-generator-ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
12 changes: 12 additions & 0 deletions
12
src/mafiasi_kultur_gui/utils/apiClient/.openapi-generator/FILES
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.openapi-generator-ignore | ||
apis/AgsApi.ts | ||
apis/MediumsApi.ts | ||
apis/index.ts | ||
index.ts | ||
models/AG.ts | ||
models/CastVoteRequest.ts | ||
models/MediumViewset.ts | ||
models/Proposal.ts | ||
models/Viewing.ts | ||
models/index.ts | ||
runtime.ts |
1 change: 1 addition & 0 deletions
1
src/mafiasi_kultur_gui/utils/apiClient/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Mafiasi Kulturgenießer API | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 0.1.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
import * as runtime from '../runtime'; | ||
import type { | ||
AG, | ||
} from '../models/index'; | ||
import { | ||
AGFromJSON, | ||
AGToJSON, | ||
} from '../models/index'; | ||
|
||
export interface AgsRetrieveRequest { | ||
id: string; | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
export class AgsApi extends runtime.BaseAPI { | ||
|
||
/** | ||
*/ | ||
async agsListRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<AG>>> { | ||
const queryParameters: any = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
const response = await this.request({ | ||
path: `/api/ags/`, | ||
method: 'GET', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(AGFromJSON)); | ||
} | ||
|
||
/** | ||
*/ | ||
async agsList(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<AG>> { | ||
const response = await this.agsListRaw(initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
/** | ||
*/ | ||
async agsRetrieveRaw(requestParameters: AgsRetrieveRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AG>> { | ||
if (requestParameters.id === null || requestParameters.id === undefined) { | ||
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling agsRetrieve.'); | ||
} | ||
|
||
const queryParameters: any = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
const response = await this.request({ | ||
path: `/api/ags/{id}/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), | ||
method: 'GET', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => AGFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
*/ | ||
async agsRetrieve(requestParameters: AgsRetrieveRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AG> { | ||
const response = await this.agsRetrieveRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
} |
142 changes: 142 additions & 0 deletions
142
src/mafiasi_kultur_gui/utils/apiClient/apis/MediumsApi.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Mafiasi Kulturgenießer API | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 0.1.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
import * as runtime from '../runtime'; | ||
import type { | ||
CastVoteRequest, | ||
MediumViewset, | ||
} from '../models/index'; | ||
import { | ||
CastVoteRequestFromJSON, | ||
CastVoteRequestToJSON, | ||
MediumViewsetFromJSON, | ||
MediumViewsetToJSON, | ||
} from '../models/index'; | ||
|
||
export interface MediumsCastVoteCreateRequest { | ||
id: string; | ||
castVoteRequest: CastVoteRequest; | ||
} | ||
|
||
export interface MediumsListRequest { | ||
ag?: string; | ||
unvotedOnly?: boolean; | ||
} | ||
|
||
export interface MediumsRetrieveRequest { | ||
id: string; | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
export class MediumsApi extends runtime.BaseAPI { | ||
|
||
/** | ||
*/ | ||
async mediumsCastVoteCreateRaw(requestParameters: MediumsCastVoteCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MediumViewset>> { | ||
if (requestParameters.id === null || requestParameters.id === undefined) { | ||
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling mediumsCastVoteCreate.'); | ||
} | ||
|
||
if (requestParameters.castVoteRequest === null || requestParameters.castVoteRequest === undefined) { | ||
throw new runtime.RequiredError('castVoteRequest','Required parameter requestParameters.castVoteRequest was null or undefined when calling mediumsCastVoteCreate.'); | ||
} | ||
|
||
const queryParameters: any = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
headerParameters['Content-Type'] = 'application/json'; | ||
|
||
const response = await this.request({ | ||
path: `/api/mediums/{id}/cast_vote/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), | ||
method: 'POST', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
body: CastVoteRequestToJSON(requestParameters.castVoteRequest), | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => MediumViewsetFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
*/ | ||
async mediumsCastVoteCreate(requestParameters: MediumsCastVoteCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MediumViewset> { | ||
const response = await this.mediumsCastVoteCreateRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
/** | ||
*/ | ||
async mediumsListRaw(requestParameters: MediumsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<MediumViewset>>> { | ||
const queryParameters: any = {}; | ||
|
||
if (requestParameters.ag !== undefined) { | ||
queryParameters['ag'] = requestParameters.ag; | ||
} | ||
|
||
if (requestParameters.unvotedOnly !== undefined) { | ||
queryParameters['unvoted_only'] = requestParameters.unvotedOnly; | ||
} | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
const response = await this.request({ | ||
path: `/api/mediums/`, | ||
method: 'GET', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(MediumViewsetFromJSON)); | ||
} | ||
|
||
/** | ||
*/ | ||
async mediumsList(requestParameters: MediumsListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<MediumViewset>> { | ||
const response = await this.mediumsListRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
/** | ||
*/ | ||
async mediumsRetrieveRaw(requestParameters: MediumsRetrieveRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MediumViewset>> { | ||
if (requestParameters.id === null || requestParameters.id === undefined) { | ||
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling mediumsRetrieve.'); | ||
} | ||
|
||
const queryParameters: any = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
const response = await this.request({ | ||
path: `/api/mediums/{id}/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), | ||
method: 'GET', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => MediumViewsetFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
*/ | ||
async mediumsRetrieve(requestParameters: MediumsRetrieveRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MediumViewset> { | ||
const response = await this.mediumsRetrieveRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export * from './AgsApi'; | ||
export * from './MediumsApi'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export * from './runtime'; | ||
export * from './apis/index'; | ||
export * from './models/index'; |
Oops, something went wrong.