-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add auto-posting from RSS #614
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,73 @@ | ||||||||||||||||||||||||||||||||
import { | ||||||||||||||||||||||||||||||||
Body, | ||||||||||||||||||||||||||||||||
Controller, | ||||||||||||||||||||||||||||||||
Delete, | ||||||||||||||||||||||||||||||||
Get, | ||||||||||||||||||||||||||||||||
Param, | ||||||||||||||||||||||||||||||||
Post, | ||||||||||||||||||||||||||||||||
Put, | ||||||||||||||||||||||||||||||||
Query, | ||||||||||||||||||||||||||||||||
} from '@nestjs/common'; | ||||||||||||||||||||||||||||||||
import { GetOrgFromRequest } from '@gitroom/nestjs-libraries/user/org.from.request'; | ||||||||||||||||||||||||||||||||
import { Organization } from '@prisma/client'; | ||||||||||||||||||||||||||||||||
import { ApiTags } from '@nestjs/swagger'; | ||||||||||||||||||||||||||||||||
import { CheckPolicies } from '@gitroom/backend/services/auth/permissions/permissions.ability'; | ||||||||||||||||||||||||||||||||
import { | ||||||||||||||||||||||||||||||||
AuthorizationActions, | ||||||||||||||||||||||||||||||||
Sections, | ||||||||||||||||||||||||||||||||
} from '@gitroom/backend/services/auth/permissions/permissions.service'; | ||||||||||||||||||||||||||||||||
import { AutopostService } from '@gitroom/nestjs-libraries/database/prisma/autopost/autopost.service'; | ||||||||||||||||||||||||||||||||
import { AutopostDto } from '@gitroom/nestjs-libraries/dtos/autopost/autopost.dto'; | ||||||||||||||||||||||||||||||||
import { XMLParser, XMLBuilder, XMLValidator } from 'fast-xml-parser'; | ||||||||||||||||||||||||||||||||
Check warning Code scanning / ESLint Disallow unused variables Warning
'XMLBuilder' is defined but never used.
Copilot Autofix AI 11 days ago To fix the problem, we need to remove the unused
Suggested changeset
1
apps/backend/src/api/routes/autopost.controller.ts
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
Check warning Code scanning / ESLint Disallow unused variables Warning
'XMLValidator' is defined but never used.
Copilot Autofix AI 11 days ago To fix the problem, we need to remove the unused import
Suggested changeset
1
apps/backend/src/api/routes/autopost.controller.ts
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
||||||||||||||||||||||||||||||||
import dayjs from 'dayjs'; | ||||||||||||||||||||||||||||||||
Check warning Code scanning / ESLint Disallow unused variables Warning
'dayjs' is defined but never used.
Copilot Autofix AI 11 days ago To fix the problem, we need to remove the unused
Suggested changeset
1
apps/backend/src/api/routes/autopost.controller.ts
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you comment a spam comment on this repository again, you will be banned from contributing to this Repository. @Azadbangladeshi-com |
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
@ApiTags('Autopost') | ||||||||||||||||||||||||||||||||
@Controller('/autopost') | ||||||||||||||||||||||||||||||||
export class AutopostController { | ||||||||||||||||||||||||||||||||
constructor(private _autopostsService: AutopostService) {} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
@Get('/') | ||||||||||||||||||||||||||||||||
async getAutoposts(@GetOrgFromRequest() org: Organization) { | ||||||||||||||||||||||||||||||||
return this._autopostsService.getAutoposts(org.id); | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
@Post('/') | ||||||||||||||||||||||||||||||||
@CheckPolicies([AuthorizationActions.Create, Sections.WEBHOOKS]) | ||||||||||||||||||||||||||||||||
async createAutopost( | ||||||||||||||||||||||||||||||||
@GetOrgFromRequest() org: Organization, | ||||||||||||||||||||||||||||||||
@Body() body: AutopostDto | ||||||||||||||||||||||||||||||||
) { | ||||||||||||||||||||||||||||||||
return this._autopostsService.createAutopost(org.id, body); | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
@Put('/:id') | ||||||||||||||||||||||||||||||||
async updateAutopost( | ||||||||||||||||||||||||||||||||
@GetOrgFromRequest() org: Organization, | ||||||||||||||||||||||||||||||||
@Body() body: AutopostDto, | ||||||||||||||||||||||||||||||||
@Param('id') id: string | ||||||||||||||||||||||||||||||||
) { | ||||||||||||||||||||||||||||||||
return this._autopostsService.createAutopost(org.id, body, id); | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
@Delete('/:id') | ||||||||||||||||||||||||||||||||
async deleteAutopost( | ||||||||||||||||||||||||||||||||
@GetOrgFromRequest() org: Organization, | ||||||||||||||||||||||||||||||||
@Param('id') id: string | ||||||||||||||||||||||||||||||||
) { | ||||||||||||||||||||||||||||||||
return this._autopostsService.deleteAutopost(org.id, id); | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
@Post('/:id/active') | ||||||||||||||||||||||||||||||||
async changeActive( | ||||||||||||||||||||||||||||||||
@GetOrgFromRequest() org: Organization, | ||||||||||||||||||||||||||||||||
@Param('id') id: string, | ||||||||||||||||||||||||||||||||
@Body('active') active: boolean | ||||||||||||||||||||||||||||||||
) { | ||||||||||||||||||||||||||||||||
return this._autopostsService.changeActive(org.id, id, active); | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
@Post('/send') | ||||||||||||||||||||||||||||||||
async sendWebhook(@Query('url') url: string) { | ||||||||||||||||||||||||||||||||
return this._autopostsService.loadXML(url); | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
} |
Check warning
Code scanning / ESLint
Disallow unused variables Warning
Copilot Autofix AI 11 days ago
To fix the problem, we need to remove the unused
XMLParser
import from the file. This will resolve the ESLint error and clean up the code. The best way to fix this is to simply delete theXMLParser
import statement from the import block at the top of the file.