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
import { Test, TestingModule } from '@nestjs/testing'; | |
import { OptionsController } from './options.controller'; | |
import { OptionsService } from './options.service'; | |
const mockOptions = { | |
_id: '62c78ca8cd673b254149b0c2', | |
backgroundColor: 'blue', | |
primaryColor: 'red', | |
secondaryColor: 'magenta', |
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
// Filler text added for confidentiality | |
function AboutCompanyScreen({ themes, darkModeEnabled }: any) { | |
// Theme & Color Pallets | |
const colors = darkModeEnabled ? themes.dark : themes.light | |
const Paragraph = ({ children }: { children: any }) => ( | |
<View | |
style={[ |
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
export const resolvers = { | |
Query: {}, | |
Mutation: { | |
loginUser: async (_, _args) => { | |
const username = _args.username; | |
const password = _args.password; | |
const version = "internal"; | |
return axios | |
.post("https://xxxxxxxxxx.com/login", { |
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
const handleSubmit = async (e) => { | |
e.preventDefault(); | |
try { | |
if (name.current.value === '' || email.current.value === '') { | |
setFieldIsEmpty(true); | |
} else { | |
const response = await fetch('https://nft-email.herokuapp.com/api/users', { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json' |
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
async addPageViews(id) { | |
const newDate = new Date(Date.now()) | |
return await this.AnalyticsModel.findByIdAndUpdate(id, { $push: {"pageViews.datesViewed": newDate}, $inc: {"pageViews.timesViewed": 1}} ,{ new: true }); | |
} |
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
async howManyClicks(analyticsId, id){ | |
const foundAnalytics = await this.findAnalyticsById(analyticsId) | |
await this.AnalyticsModel.findByIdAndUpdate(analyticsId, | |
{ $inc: {totalLinkClicks: 1}}, | |
{ new: true } | |
) | |
const foundLink = await foundAnalytics.linksClicked.filter((link) => { | |
return link.linkId === id; | |
}); | |
if (foundLink.length > 0) { |