Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(planner-advert): setup data layer
Browse files Browse the repository at this point in the history
mikolaj-jalocha committed Jan 25, 2025
1 parent 3a66dac commit 27dbab4
Showing 4 changed files with 1,487 additions and 1,431 deletions.
2,886 changes: 1,456 additions & 1,430 deletions lib/api_base/schema.graphql

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion lib/config/ttl_config.dart
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ enum TtlKey {
buildingsRepository,
guideDetailsRepository,
guideRepository,
changelogRepository
changelogRepository,
plannerAdvertRepository
// ... add a new key here if you create a new repository
}

@@ -38,6 +39,7 @@ abstract class TtlStrategy {
day, // leaving as day for now, cause maybe some uni orgs will update it by themselves
TtlKey.guideRepository => week,
TtlKey.changelogRepository => week,
TtlKey.plannerAdvertRepository => day
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
query GetPlannerAdvertContent {
PlannerAdvert {
isEnabled,
title,
description,
url
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import "package:flutter_riverpod/flutter_riverpod.dart";
import "package:riverpod_annotation/riverpod_annotation.dart";

import "../../../api_base/query_adapter.dart";
import "../../../config/ttl_config.dart";
import "getPlannerAdvertContent.graphql.dart";

part "planner_advert_repository.g.dart";

typedef PlannerAdvertContent = Query$GetPlannerAdvertContent$PlannerAdvert;

@riverpod
Future<PlannerAdvertContent?> plannerAdvertContentRepository(Ref ref) async {
final results = await ref.queryGraphql(
Options$Query$GetPlannerAdvertContent(),
TtlKey.plannerAdvertRepository,
);

return results?.PlannerAdvert;
}

0 comments on commit 27dbab4

Please sign in to comment.