-
Notifications
You must be signed in to change notification settings - Fork 465
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 #524 from ever-co/develop
New features: - Track merchants (warehouses) on the map (with filtering) - Payment Gateways config on the Merchant Wizard Note: DB structure changes, you may need to regenerate DB or migrate your schema/data manually
- Loading branch information
Showing
48 changed files
with
1,786 additions
and
29 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
admin/website-angular/src/app/@core/data/currencies.service.ts
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,65 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Apollo } from 'apollo-angular'; | ||
import { Observable } from 'rxjs'; | ||
import Currency from '@modules/server.common/entities/Currency'; | ||
import gql from 'graphql-tag'; | ||
import { map, share } from 'rxjs/operators'; | ||
|
||
export interface CurrencyMutationRespone { | ||
success: boolean; | ||
message?: string; | ||
data?: Currency; | ||
} | ||
|
||
@Injectable() | ||
export class CurrenciesService { | ||
constructor(private readonly apollo: Apollo) {} | ||
|
||
private currencies$: Observable<Currency[]> = this.apollo | ||
.watchQuery<{ currencies: Currency[] }>({ | ||
query: gql` | ||
query allCurrencies { | ||
currencies { | ||
currencyCode | ||
} | ||
} | ||
`, | ||
pollInterval: 2000 | ||
}) | ||
.valueChanges.pipe( | ||
map((result) => result.data.currencies), | ||
share() | ||
); | ||
|
||
getCurrencies(): Observable<Currency[]> { | ||
return this.currencies$; | ||
} | ||
|
||
create(createInput: { | ||
currencyCode: string; | ||
}): Observable<CurrencyMutationRespone> { | ||
return this.apollo | ||
.mutate<{ createCurrency: CurrencyMutationRespone }>({ | ||
mutation: gql` | ||
mutation CreateCurrency( | ||
$createInput: CurrencyCreateInput! | ||
) { | ||
createCurrency(createInput: $createInput) { | ||
success | ||
message | ||
data { | ||
currencyCode | ||
} | ||
} | ||
} | ||
`, | ||
variables: { | ||
createInput | ||
} | ||
}) | ||
.pipe( | ||
map((result) => result.data.createCurrency), | ||
share() | ||
); | ||
} | ||
} |
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
12 changes: 11 additions & 1 deletion
12
admin/website-angular/src/app/@shared/file-uploader/file-uploader.component.ts
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
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
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
Oops, something went wrong.