Skip to content

Commit edf5448

Browse files
committed
feat: add description to the flag properties
1 parent 1d887bf commit edf5448

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/flag.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type Condition =
1010

1111
export interface Flag {
1212
name: string;
13+
description?: string;
1314
percentage: FlagPercentage;
1415
app: string;
1516
owner: string;

src/index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { json, notFound, text } from "./util/response";
88

99
interface FlagPayload {
1010
flagName: string;
11+
description?: string;
1112
percentage: FlagPercentage;
1213
}
1314

@@ -21,7 +22,8 @@ router.get("/", () => new Response("Hello! Flargd Edge Feature Flags!"));
2122
router.post("/apps/:app/flag", async (req, env: Env) => {
2223
try {
2324
// TODO: validate input
24-
const { flagName, percentage } = (await req.json()) as FlagPayload;
25+
const { flagName, description, percentage } =
26+
(await req.json()) as FlagPayload;
2527
const { app } = req.params;
2628

2729
const flagKey = createFlagKey({ prefix: OWNER, flagName, app });
@@ -33,11 +35,13 @@ router.post("/apps/:app/flag", async (req, env: Env) => {
3335
flag = {
3436
...existingFlag,
3537
percentage,
38+
description,
3639
updatedAt: date,
3740
};
3841
} else {
3942
flag = {
4043
name: flagName,
44+
description,
4145
percentage,
4246
createdAt: date,
4347
updatedAt: date,

0 commit comments

Comments
 (0)