Skip to content

Commit

Permalink
refactor - description changed to base class.
Browse files Browse the repository at this point in the history
  • Loading branch information
MohanKumarAmbati committed Oct 23, 2024
1 parent 7fc89c3 commit 2537aea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 4 additions & 1 deletion services/scoop/scoop-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const bucketsSchema = Joi.object()
.pattern(/.+/, Joi.string().pattern(gitHubRepoRegExp).required())
.required()

export default class ScoopBase extends ConditionalGithubAuthV3Service {
export class ScoopBase extends ConditionalGithubAuthV3Service {
async fetch({ app, schema }, queryParams) {
if (!this.buckets) {
this.buckets = await fetchJsonFromRepo(this, {
Expand Down Expand Up @@ -68,3 +68,6 @@ export default class ScoopBase extends ConditionalGithubAuthV3Service {
}
}
}

export const description =
"App's containing bucket. Can either be a name (e.g `extras`) or a URL to a GitHub Repo (e.g `https://github.com/jewlexx/personal-scoop`)"
5 changes: 2 additions & 3 deletions services/scoop/scoop-license.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Joi from 'joi'
import { pathParam, queryParam } from '../index.js'
import { renderLicenseBadge } from '../licenses.js'
import toArray from '../../core/base-service/to-array.js'
import ScoopBase from './scoop-base.js'
import { description, ScoopBase } from './scoop-base.js'

const scoopLicenseSchema = Joi.object({
license: Joi.alternatives()
Expand Down Expand Up @@ -42,8 +42,7 @@ export default class ScoopLicense extends ScoopBase {
pathParam({ name: 'app', example: 'ngrok' }),
queryParam({
name: 'bucket',
description:
"App's containing bucket. Can either be a name (e.g `extras`) or a URL to a GitHub Repo (e.g `https://github.com/jewlexx/personal-scoop`)",
description,
example: 'extras',
}),
],
Expand Down
5 changes: 2 additions & 3 deletions services/scoop/scoop-version.service.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Joi from 'joi'
import { pathParam, queryParam } from '../index.js'
import { renderVersionBadge } from '../version.js'
import ScoopBase from './scoop-base.js'
import { description, ScoopBase } from './scoop-base.js'

const scoopSchema = Joi.object({
version: Joi.string().required(),
Expand Down Expand Up @@ -33,8 +33,7 @@ export default class ScoopVersion extends ScoopBase {
pathParam({ name: 'app', example: 'ngrok' }),
queryParam({
name: 'bucket',
description:
"App's containing bucket. Can either be a name (e.g `extras`) or a URL to a GitHub Repo (e.g `https://github.com/jewlexx/personal-scoop`)",
description,
example: 'extras',
}),
],
Expand Down

0 comments on commit 2537aea

Please sign in to comment.