Skip to content

Commit

Permalink
Merge pull request #121 from akhill10/feat/app-bundle-retention
Browse files Browse the repository at this point in the history
feat: added option to set bundle retention on app
  • Loading branch information
riderx authored Aug 17, 2023
2 parents 9b56a7a + 6378bd1 commit b05d3ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/api/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const checkAppExistsAndHasPermissionErr = async (supabase: SupabaseClient
export interface Options extends OptionsBase {
name?: string;
icon?: string;
retention?: number;
}

export const newIconPath = "assets/icon.png"
12 changes: 11 additions & 1 deletion src/app/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ export const setApp = async (appId: string, options: Options) => {
// Check we have app access to this appId
await checkAppExistsAndHasPermissionErr(supabase, appId, options.apikey);

const { name, icon } = options;
const { name, icon, retention } = options;

if (retention && !isNaN(Number(retention))) {
p.log.error(`retention value must be a number`);
program.error(``);
}
else if (retention && retention < 0) {
p.log.error(`retention value cannot be less than 0`);
program.error(``)
}

let iconBuff;
let iconType;
Expand Down Expand Up @@ -68,6 +77,7 @@ export const setApp = async (appId: string, options: Options) => {
.update({
icon_url: signedURL,
name,
retention: retention === 0 ? null : retention,
})
.eq('app_id', appId)
.eq('user_id', userId)
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ app
.action(listApp)
.option('-a, --apikey <apikey>', 'apikey to link to your account');

app
app
.command('debug [appId]')
.alias('d')
.description('Listen for live updates event in Capgo Cloud to debug your app')
Expand All @@ -95,7 +95,8 @@ app
.action(setApp)
.option('-n, --name <name>', 'app name')
.option('-i, --icon <icon>', 'app icon path')
.option('-a, --apikey <apikey>', 'apikey to link to your account');
.option('-a, --apikey <apikey>', 'apikey to link to your account')
.option('-r, --retention <retention>', 'retention period of app bundle in days')

const bundle = program
.command('bundle')
Expand Down

0 comments on commit b05d3ed

Please sign in to comment.