EKERBH2GMXCDZSFXAQP6FGGQTTW3ZENOUM4ZKZVHWAAKGW64YLTAC
async fn hello(&self) -> Result<String> {
Ok("hello".to_string())
async fn guild(
&self,
ctx: &Context<'_>,
guild: String,
server_slug: String,
region_slug: String,
) -> Result<Option<Team>> {
use crate::schema::teams::dsl;
let Data { conpool, .. } = ctx.data()?;
Ok(dsl::teams
.filter(
dsl::name
.eq(guild)
.and(dsl::server_slug.eq(server_slug))
.and(dsl::region_slug.eq(region_slug)),
)
.first(&*conpool.get()?)
.optional()?)
}
async fn tag(&self, ctx: &Context<'_>, id: i64) -> Result<Option<Team>> {
use crate::schema::teams::dsl;
let Data { conpool, .. } = ctx.data()?;
Ok(dsl::teams
.filter(dsl::id.eq(id as i32))
.first(&*conpool.get()?)
.optional()?)
const META_QUERY = gql`
query DetailsMeta($region: String!, $server: String!, $guild: String!, $tag: Int!, $zone: Int!) {
guild(name: $guild, serverSlug: $server, region: $region) {
name, server, tags { id, name }
}
reports(tag: $tag, zone: $zone) {
code, title, startTime, endTime
const TAG_QUERY = gql`
query DetailsMeta($tag: Int!) {
tag(id: $tag) {
name, tagName
const tagData = data.guild.tags.find((tag: any) => tag.id === tagid);
const weeks = data.reports.reduce((acc: any, report: any) => {
const week = tierWeek(tier!, new Date(report.startTime), true, toRegion(region));
if(!acc[week]) {
acc[week] = [];
}
acc[week].push({ ...report, week });
return acc;
}, {});
<legend className="text-5xl">{data.guild.name || guild} {tagData ? ' - ' + tagData.name : ''}</legend>
<p className="text-2xl">{region.toUpperCase()} - {data.guild.server}</p>
<legend className="text-5xl">{data.tag.name || guild} {data.tag.tagName ? ` - ${data.tag.tagName}` : ''}</legend>
<p className="text-2xl">{region.toUpperCase()} - {server}</p>
{Object.entries(weeks).sort().reverse().map(([week, reports]: [any, any]) => (
<section key={week} className="mt-10">
<legend className="font-sans text-3xl">Week {week}</legend>
<dl>
{reports.map((report: any) => (
<>
<dt className="font-bold">{report.title}</dt>
<dd>Nothing goes here yet</dd>
</>
))}
</dl>
</section>
))}