generated from pagopa/io-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cb4f44
commit 53e7256
Showing
1 changed file
with
44 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as t from "io-ts"; | ||
import { NonEmptyString } from "@pagopa/ts-commons/lib/strings"; | ||
import { Container } from "@azure/cosmos"; | ||
import { CosmosResource, CosmosdbModel } from "../utils/cosmosdb_model"; | ||
|
||
export const USER_RC_CONFIGURATIONS_COLLECTION_NAME = "user-configurations"; | ||
const USER_RC_CONFIGURATIONS_MODEL_PK_FIELD = "userId"; | ||
|
||
const UserRCConfiguration = t.interface({ | ||
userId: NonEmptyString, | ||
id: NonEmptyString | ||
}); | ||
export type UserRCConfiguration = t.TypeOf<typeof UserRCConfiguration>; | ||
|
||
export const RetrievedUserRCConfiguration = t.intersection([ | ||
UserRCConfiguration, | ||
CosmosResource | ||
]); | ||
export type RetrievedUserRCConfiguration = t.TypeOf< | ||
typeof RetrievedUserRCConfiguration | ||
>; | ||
|
||
/** | ||
* @deprecated This model is deprecated, use the one inside ./remote_content.ts instead | ||
*/ | ||
export class UserRCConfigurationModel extends CosmosdbModel< | ||
UserRCConfiguration, | ||
UserRCConfiguration, | ||
RetrievedUserRCConfiguration, | ||
typeof USER_RC_CONFIGURATIONS_MODEL_PK_FIELD | ||
> { | ||
/** | ||
* Creates a new RemoteContentConfiguration model | ||
* | ||
* @param container the Cosmos container client | ||
*/ | ||
constructor(container: Container) { | ||
super( | ||
container, | ||
UserRCConfiguration, | ||
RetrievedUserRCConfiguration | ||
); | ||
} | ||
} |