-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1135 from givepraise/add/current-community
Current community
- Loading branch information
Showing
11 changed files
with
162 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { PaginatedQueryDto } from '../../shared/dto/pagination-query.dto'; | ||
import { IsOptional } from 'class-validator'; | ||
|
||
export class CommunityFindAllQueryDto extends PaginatedQueryDto { | ||
@ApiProperty({ | ||
required: false, | ||
type: 'string', | ||
example: 'hostname.givepraise.xyz', | ||
}) | ||
@IsOptional() | ||
hostname?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* The features object is used to enable or disable features for a community. | ||
*/ | ||
export type Features = { | ||
attestations: boolean; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { AxiosError, AxiosResponse } from 'axios'; | ||
import { selector } from 'recoil'; | ||
import { ApiGet, isResponseOk } from '../api'; | ||
import { Community } from './dto/community.dto'; | ||
|
||
export const CurrentCommunityQuery = selector({ | ||
key: 'CurrentCommunity', | ||
get: ({ get }): AxiosResponse<Community> | AxiosError => { | ||
return get(ApiGet({ url: '/communities/current' })) as | ||
| AxiosResponse<Community> | ||
| AxiosError; | ||
}, | ||
}); | ||
|
||
export const CurrentCommunity = selector({ | ||
key: 'AllReports', | ||
get: ({ get }): Community | undefined => { | ||
const response = get(CurrentCommunityQuery); | ||
|
||
if (isResponseOk(response)) { | ||
return response.data; | ||
} | ||
|
||
return; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { components } from 'api-types'; | ||
|
||
export type Community = components['schemas']['Community']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters